/*
 * P2GR Management UI stylesheet.
 *
 * Deliberately a sibling of styles.css, not a shared file — this UI is
 * deployed on its own subdomain (manage.place2goround.taxi) from its own
 * three files, so it needs its own copy of the design tokens. The tokens and
 * most component patterns below (brand colors, buttons, badges, cards,
 * tabs, notice/empty states) are copied from styles.css on purpose, so the
 * Management UI reads as the same product family as the driver/PA portal
 * rather than a redesign.
 */

:root {
  color-scheme: light;
  --ink: #102326;
  --muted: #5e6f73;
  --line: #d8e3e1;
  --paper: #f7faf8;
  --panel: #ffffff;
  --brand: #0b5b5f;
  --brand-strong: #083f42;
  --accent: #d94532;
  --success: #16784f;
  --warning: #ad6b00;
  --blue: #235f9c;
  --shadow: 0 14px 32px rgba(12, 42, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 0%, rgba(11, 91, 95, 0.08), transparent 28rem),
    linear-gradient(180deg, #f4faf7 0%, #eef5f2 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 1280px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 18px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 850;
}

.brand-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.manager-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.88rem;
}

.manager-strip strong {
  color: var(--ink);
}

/* ---- login / loading / error states (mirrors styles.css) ---- */

.login-view,
.loading-view {
  display: grid;
  min-height: 100vh;
  align-content: center;
  gap: 18px;
  padding: max(18px, env(safe-area-inset-top)) 0 max(120px, env(safe-area-inset-bottom));
}

.login-panel,
.loading-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
}

.loading-panel {
  display: grid;
  gap: 20px;
  border-width: 2px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.94)),
    radial-gradient(circle at 10% 0%, rgba(11, 91, 95, 0.12), transparent 18rem);
}

.error-panel {
  border-color: #e7b7ad;
}

.loading-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.loading-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 950;
  box-shadow: var(--shadow);
}

.loading-copy h1,
.login-title {
  margin: 0;
  font-size: clamp(1.5rem, 6vw, 1.9rem);
  line-height: 1.1;
}

.loading-copy p,
.login-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.loading-bar {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2ede9;
}

.loading-bar span {
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: 999px;
  background: var(--brand);
  animation: mgmt-loading-sweep 1.1s ease-in-out infinite;
}

@keyframes mgmt-loading-sweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

.loading-skeleton {
  display: grid;
  gap: 10px;
}

.loading-skeleton span {
  height: 14px;
  border-radius: 6px;
  background: #e2ede9;
}

.loading-skeleton span:last-child {
  width: 65%;
}

.login-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.input-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.text-input {
  min-height: 54px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  font-size: 1rem;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 52px;
  border-radius: 8px;
  font-weight: 900;
  letter-spacing: 0;
}

.primary-button {
  width: 100%;
  border: 0;
  padding: 0 18px;
  background: var(--brand);
  color: #fff;
  font-size: 1.02rem;
  box-shadow: var(--shadow);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.secondary-button,
.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-strong);
  padding: 0 14px;
}

.secondary-button.compact {
  width: auto;
  min-width: 92px;
  min-height: 44px;
}

/* ---- dashboard shell ---- */

.dash-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 20px;
  border: 2px solid #cbdad7;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(12, 42, 42, 0.08);
}

.dash-kicker {
  margin: 0 0 4px;
  color: var(--success);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.dash-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1.05;
}

.dash-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-tile {
  min-width: 108px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  text-align: center;
}

.stat-tile strong {
  display: block;
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--brand-strong);
}

.stat-tile span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

.stat-tile.alert strong {
  color: var(--accent);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand-strong);
  font-weight: 850;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.25);
  font-size: 0.78rem;
}

.tab:not(.active) .tab-count {
  background: #eaf1ef;
  color: var(--brand-strong);
}

.read-only-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #d9c79f;
  border-radius: 8px;
  background: #fff8e7;
  color: #5f3d00;
  font-weight: 800;
  line-height: 1.35;
}

/* ---- journey / queue lists ---- */

.card-list {
  display: grid;
  gap: 12px;
}

.op-card,
.queue-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(12, 42, 42, 0.08);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.op-head,
.queue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 7px;
  padding: 0 9px;
  background: #eaf1ef;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.badge.period {
  background: var(--brand);
  color: #fff;
}

.badge.ok {
  background: #e4f5ec;
  color: var(--success);
}

.badge.pending {
  background: #fff2d9;
  color: #805100;
}

.badge.attention {
  background: #fdeae6;
  color: #8b1e12;
}

.badge.muted {
  background: #eef2f1;
  color: var(--muted);
}

.op-title,
.queue-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.15;
}

.op-route {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.assignment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.assignment-slot {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7faf8;
}

.assignment-slot .role-label {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.assignment-slot .role-name {
  margin: 0;
  font-weight: 850;
  font-size: 1rem;
}

.notice {
  margin: 0;
  padding: 12px;
  border-left: 5px solid var(--warning);
  border-radius: 6px;
  background: #fff8eb;
  color: #5f3d00;
  line-height: 1.35;
  font-weight: 760;
}

.notice.attention {
  border-left-color: var(--accent);
  background: #fff1ee;
  color: #823426;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reason-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reason-list li {
  padding: 8px 10px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #fff1ee;
  color: #823426;
  font-weight: 750;
  font-size: 0.9rem;
  line-height: 1.35;
}

.submission-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7faf8;
}

.submission-panel h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
  color: var(--muted);
}

.info-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.92rem;
}

.info-label {
  color: var(--muted);
  font-weight: 700;
}

.info-value {
  font-weight: 800;
  text-align: right;
}

.empty {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--success);
  font-size: 1.05rem;
}

@media (min-width: 680px) {
  .app-shell {
    padding-inline: 24px;
  }

  .login-view {
    justify-items: center;
  }

  .login-panel {
    width: min(100%, 480px);
  }
}

@media (min-width: 920px) {
  .app-shell {
    padding-top: 30px;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 220px));
  }

  .card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (min-width: 1220px) {
  .card-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .assignment-grid {
    grid-template-columns: 1fr;
  }
}
