/* NEOHIVE operational extensions — layered on top of the existing theme tokens. */
.password-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, rgba(34,214,166,.14), transparent 34%), #020807; }
.password-gate[hidden], .app[hidden] { display: none; }
.password-card { width: min(420px, 100%); display: grid; gap: 16px; padding: 32px; border: 1px solid rgba(80,220,177,.24); border-radius: 14px; background: linear-gradient(180deg, rgba(9,24,20,.98), rgba(5,15,12,.98)); box-shadow: 0 24px 70px rgba(0,0,0,.46); }
.password-logo { width: 92px; height: 92px; object-fit: contain; justify-self: center; }
.password-card h1 { text-align: center; color: #effff8; }
.password-eyebrow { margin: 0 0 7px; text-align: center; color: var(--brand); font-size: 12px; font-weight: 900; letter-spacing: .16em; }
.password-help { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.password-input { height: 48px; padding: 0 14px; text-align: center; font-size: 21px; letter-spacing: .28em; }
.password-error { min-height: 20px; margin: -6px 0 0; color: #ff9ba2; font-size: 12px; text-align: center; }
.password-submit { width: 100%; min-height: 48px; }

.role-switcher { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(34, 214, 166, .06); }
.role-switcher label { color: var(--brand); font-size: 11px; }
.role-switcher select { height: 36px; font-size: 13px; }
.role-hint { color: var(--muted); font-size: 11px; line-height: 1.45; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.role-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-size: 12px; font-weight: 900; }

.ops-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ops-metrics .metric { min-height: 120px; }
.metric small.warning { color: var(--amber); }
.metric small.danger-text { color: #ff8a92; }
.metric-icon { color: var(--brand); }
.operation-list, .task-list, .vehicle-list, .attendance-list, .history-list { display: grid; gap: 10px; }
.operation-card { display: grid; grid-template-columns: minmax(220px, 1.15fr) minmax(290px, 1fr) auto; gap: 16px; align-items: center; padding: 15px 16px; border: 1px solid rgba(80,220,177,.14); border-radius: var(--radius); background: rgba(255,255,255,.025); }
.operation-card h3 { margin: 0 0 5px; }
.operation-meta { color: var(--muted); font-size: 12px; line-height: 1.5; }
.operation-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.operation-stat { min-height: 54px; display: grid; align-content: center; justify-items: center; gap: 3px; border-radius: 8px; background: rgba(255,255,255,.035); border: 1px solid rgba(80,220,177,.08); }
.operation-stat strong { color: var(--brand); font-size: 16px; }
.operation-stat span { color: var(--muted); font-size: 11px; text-align: center; }
.operation-stat.warning strong { color: var(--amber); }
.operation-stat.danger strong { color: #ff8a92; }

.task-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid rgba(80,220,177,.14); border-radius: 8px; background: rgba(255,255,255,.025); }
.task-type { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--brand); background: rgba(34,214,166,.1); }
.task-type.high { color: #ff949b; background: rgba(224,90,100,.12); }
.task-copy { min-width: 0; }
.task-copy strong { display: block; color: #eafff8; font-size: 14px; }
.task-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.task-actions button { min-height: 34px; }
.empty-state { display: grid; place-items: center; min-height: 160px; text-align: center; color: var(--muted); border: 1px dashed rgba(80,220,177,.25); border-radius: 8px; padding: 22px; }
.compact-empty { min-height: 82px; }
.dashboard-priority { border-color: rgba(242,201,76,.28); }
.recent-activity-list { display: grid; padding: 0 16px 10px; }
.recent-activity-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 38px; border-top: 1px solid rgba(80,220,177,.1); color: var(--muted); font-size: 12px; }
.recent-activity-row:first-child { border-top: 0; }
.recent-activity-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--brand); background: rgba(34,214,166,.09); }
.recent-activity-icon svg { width: 14px; height: 14px; }
.recent-activity-message { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-activity-row time { white-space: nowrap; }

.view-tabs, .profile-tabs, .status-segment { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-button, .status-button, .filter-chip { min-height: 36px; border-radius: 8px; padding: 0 11px; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--muted); font-weight: 800; font-size: 12px; }
.tab-button.active, .filter-chip.active { color: var(--brand); border-color: rgba(34,214,166,.65); background: rgba(34,214,166,.12); }
.attendance-toolbar { display: grid; grid-template-columns: 172px minmax(150px, 180px) minmax(220px, 1fr) auto; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: rgba(5,18,15,.78); }
.attendance-toolbar input { padding-left: 12px; }
.attendance-row { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 14px; align-items: center; padding: 13px 14px; border: 1px solid rgba(80,220,177,.12); border-radius: 8px; background: rgba(255,255,255,.025); }
.attendance-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.attendance-person .avatar { width: 36px; height: 36px; }
.attendance-person strong { display: block; }
.attendance-person span { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; }
.status-segment { justify-content: flex-end; }
.status-button { min-width: 48px; padding: 0 8px; }
.status-button.present.active { color: #02120d; border-color: var(--brand); background: var(--brand); }
.status-button.absent.active { color: #fff; border-color: var(--danger); background: var(--danger); }
.status-button.makeup.active { color: #03110e; border-color: var(--amber); background: var(--amber); }
.status-button.paused.active { color: #fff; border-color: #66756e; background: #66756e; }
.quick-qr { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; gap: 8px; }
.quick-qr input { padding-left: 12px; }
.attendance-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.history-row { display: grid; grid-template-columns: 96px minmax(160px, 1fr) minmax(140px, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid rgba(80,220,177,.12); border-radius: 8px; background: rgba(255,255,255,.025); font-size: 13px; }

.member-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.member-filters.has-payment { grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, 160px)); }
.profile-tabs { padding: 0 18px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; flex-wrap: nowrap; }
.profile-tabs .tab-button { flex: 0 0 auto; }
.profile-section { padding: 18px; display: grid; gap: 13px; }
.profile-line { display: grid; grid-template-columns: 100px 1fr; gap: 10px; color: var(--muted); font-size: 13px; }
.profile-line strong { color: var(--ink); }
.profile-quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.class-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.class-card { padding: 16px; display: grid; gap: 14px; }
.class-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.class-card-top h3 { margin: 0 0 5px; }
.class-card-meta { color: var(--muted); font-size: 12px; line-height: 1.5; }
.class-capacity { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.class-capacity div { padding: 10px; border: 1px solid rgba(80,220,177,.1); border-radius: 8px; background: rgba(255,255,255,.03); }
.class-capacity strong { display: block; color: var(--brand); font-size: 16px; }
.class-capacity span { color: var(--muted); font-size: 11px; }

.vehicle-route { display: grid; gap: 12px; }
.vehicle-route-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vehicle-route-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.vehicle-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(150px, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid rgba(80,220,177,.12); border-radius: 8px; background: rgba(255,255,255,.025); }
.vehicle-row .muted { font-size: 12px; }
.exception-note { color: #ffe08a; font-size: 12px; }

.schedule-compact { color: var(--muted); font-size: 12px; line-height: 1.6; }
.count-pill { display: inline-flex; align-items: center; min-height: 25px; padding: 0 8px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.055); font-size: 11px; font-weight: 800; }
.count-pill.ok { color: var(--brand); background: rgba(34,214,166,.1); }
.count-pill.warn { color: var(--amber); background: rgba(242,201,76,.1); }
.count-pill.danger { color: #ffadb2; background: rgba(224,90,100,.1); }
.payment-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.payment-filters { grid-template-columns: minmax(140px, 180px) minmax(180px, 1fr) auto auto; align-items: center; }
.filter-result { color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
button:disabled { cursor: not-allowed; opacity: .45; }

.dialog-wide { width: min(820px, calc(100vw - 28px)); }
.dialog-xwide { width: min(1040px, calc(100vw - 28px)); }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.qr-camera { width: 100%; min-height: 260px; border-radius: 8px; background: #010403; border: 1px solid var(--line); object-fit: cover; }
.qr-status { padding: 12px; border-radius: 8px; border: 1px solid rgba(80,220,177,.12); color: var(--muted); font-size: 13px; line-height: 1.55; }
.recipient-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 210px; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.recipient-picker label { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; }
.recipient-picker input { width: 16px; height: 16px; padding: 0; }

body.light-theme .role-switcher,
body.light-theme .operation-card,
body.light-theme .task-row,
body.light-theme .attendance-row,
body.light-theme .history-row,
body.light-theme .vehicle-row,
body.light-theme .operation-stat,
body.light-theme .class-capacity div { background: var(--soft); }
body.light-theme .task-copy strong,
body.light-theme .operation-card h3 { color: var(--ink); }

@media (max-width: 1280px) {
  .ops-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .member-layout { grid-template-columns: 1fr; }
  .operation-card { grid-template-columns: 1fr; }
  .operation-stats { max-width: 560px; }
  .operation-card .mini-actions { justify-content: flex-start; }
}
@media (max-width: 980px) {
  .attendance-toolbar { grid-template-columns: 1fr 1fr; }
  .payment-filters, .member-filters.has-payment { grid-template-columns: 1fr 1fr; }
  .attendance-row { grid-template-columns: 1fr; }
  .status-segment { justify-content: flex-start; }
  .class-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .ops-metrics, .attendance-toolbar, .form-grid-3, .recipient-picker, .payment-filters, .member-filters.has-payment { grid-template-columns: 1fr; }
  .operation-stats { grid-template-columns: repeat(3, 1fr); }
  .history-row, .vehicle-row { grid-template-columns: 1fr; }
  .quick-qr { grid-template-columns: 1fr; }
  .task-row { grid-template-columns: auto 1fr; }
  .task-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .recent-activity-row { grid-template-columns: auto 1fr; padding: 7px 0; }
  .recent-activity-row time { grid-column: 2; }
}

/* Mobile workspace: compact shell, touch targets, and card-style data tables. */
@media (max-width: 760px) {
  body { overflow-x: hidden; }
  .password-gate { min-height: 100svh; padding: 16px; }
  .password-card { padding: 24px; }

  .sidebar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "brand role"
      "nav nav";
    align-items: center;
    justify-content: stretch;
    gap: 8px 12px;
    padding: max(8px, env(safe-area-inset-top)) 12px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { grid-area: brand; width: auto; min-width: 0; gap: 8px; padding: 0; }
  .brand > span:last-child { display: block; }
  .brand > span:last-child > span { display: none; }
  .brand strong { font-size: 16px; }
  .mark { width: 44px; height: 44px; }
  .role-switcher {
    grid-area: role;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .role-switcher label, .role-hint { display: none; }
  .role-switcher select { height: 44px; min-width: 0; padding-inline: 12px; font-size: 16px; }
  .nav {
    grid-area: nav;
    width: calc(100% + 24px);
    min-width: 0;
    margin-inline: -12px;
    padding: 0 12px 8px;
    display: flex;
    gap: 5px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav span { display: inline; font-size: 12px; font-weight: 800; }
  .nav button {
    flex: 0 0 auto;
    width: auto;
    min-width: 82px;
    height: 44px;
    padding: 0 10px;
    justify-content: center;
    gap: 7px;
    scroll-snap-align: start;
  }
  .sidebar-foot { display: none; }

  .topbar { padding: 16px; gap: 14px; }
  .topbar > div:first-child { min-width: 0; }
  .topbar h1 { font-size: 20px; }
  .actions { justify-content: flex-start; gap: 8px; }
  .actions .role-badge { display: none; }
  .actions > button:not(.icon-btn) { flex: 1 1 130px; min-width: 0; }
  .content { padding: 14px; gap: 14px; }
  .panel-body { padding: 14px; }
  .content .panel-head { min-height: 0; align-items: flex-start; flex-wrap: wrap; padding: 14px; }
  .content .panel-head > div:first-child { min-width: 0; flex: 1 1 190px; }
  .content .panel-head > .view-tabs,
  .content .panel-head > .payment-summary { width: 100%; }
  .payment-summary { justify-content: flex-start; }

  .metrics, .ops-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric, .ops-metrics .metric { min-height: 106px; padding: 14px; }
  .metric strong { font-size: 26px; }
  .operation-card { padding: 14px; gap: 14px; }
  .operation-stats { max-width: none; }

  .icon-btn, .primary, .ghost, .danger, .success,
  .tab-button, .status-button, .filter-chip, .task-actions button { min-height: 44px; }
  .icon-btn { width: 44px; }
  input, select { height: 44px; }
  input, select, textarea { font-size: 16px; }
  textarea { min-height: 100px; }

  .status-segment { width: 100%; }
  .status-button { min-width: 64px; }
  .split, .class-card-top, .vehicle-route-head { align-items: flex-start; flex-wrap: wrap; }
  .mini-actions > button, .task-actions > button { flex: 1 1 120px; }
  .vehicle-row > button { width: 100%; }
  .profile-line { grid-template-columns: 84px minmax(0, 1fr); }
  .profile-line strong, .event span, .receipt { overflow-wrap: anywhere; }
  .filter-result { white-space: normal; }
  .task-copy span, .recent-activity-message {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  dialog, .dialog-wide, .dialog-xwide {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    overflow: hidden;
  }
  dialog > form {
    max-height: calc(100dvh - 18px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }
  dialog .panel-head { position: sticky; top: 0; z-index: 1; flex-wrap: nowrap; background: #071410; }
  dialog .modal-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  body.light-theme dialog .panel-head { background: #fff; }
  .qr-camera { min-height: 0; max-height: 40dvh; aspect-ratio: 4 / 3; }
  .weekday-grid { gap: 4px; }
  .weekday-grid span { min-height: 44px; }

  .toast {
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .mobile-card-table { overflow: visible; padding: 12px; }
  .mobile-card-table table, .mobile-card-table tbody,
  .mobile-card-table tr, .mobile-card-table td { display: block; width: 100%; }
  .mobile-card-table table { min-width: 0; }
  .mobile-card-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .mobile-card-table tbody { display: grid; gap: 10px; }
  .mobile-card-table tr {
    padding: 12px;
    border: 1px solid rgba(80,220,177,.14);
    border-radius: 8px;
    background: rgba(255,255,255,.025);
  }
  .mobile-card-table tr.selected { border-color: rgba(34,214,166,.65); background: rgba(34,214,166,.08); }
  .mobile-card-table td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(80,220,177,.1);
  }
  .mobile-card-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }
  .mobile-card-table td:last-child { border-bottom: 0; }
  .mobile-card-table td[colspan] { display: block; padding: 0; border-bottom: 0; }
  .mobile-card-table td[colspan]::before { content: none; }
  .mobile-card-table .member { min-width: 0; }
  .mobile-card-table .progress { width: 100%; max-width: 150px; }
  .mobile-card-table .mini-actions { justify-content: flex-start; }
  body.light-theme .mobile-card-table tr { background: var(--soft); }
}

@media (max-width: 360px) {
  .brand > span:last-child { display: none; }
}

@media (max-width: 340px) {
  .metrics, .ops-metrics { grid-template-columns: 1fr; }
}
