/* ============================================================
   美团专送跑单系统 — 后台样式
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:        #0066cc;
  --blue-focus:  #0071e3;
  --ink:         #1d1d1f;
  --ink80:       rgba(0,0,0,0.80);
  --ink48:       rgba(0,0,0,0.48);
  --ink08:       rgba(0,0,0,0.08);
  --ink04:       rgba(0,0,0,0.04);
  --white:       #ffffff;
  --parchment:   #f5f5f7;
  --pearl:       #fafafc;
  --tile1:       #272729;
  --nav-bg:      #000000;
  --sidebar-bg:  #1a1a1c;
  --radius-pill: 980px;
  --radius-card: 18px;
  --radius-btn:  8px;
  --font: "system-ui","-apple-system","BlinkMacSystemFont","Helvetica Neue",Helvetica,Arial,sans-serif;

  --status-online:#34c759;
  --status-busy:  #ff9f0a;
  --status-offline:#8e8e93;
}

html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font); color: var(--ink);
  background: var(--parchment); line-height: 1.47;
  letter-spacing: -0.374px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh; background: var(--tile1);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--white); border-radius: var(--radius-card);
  padding: 48px 40px;
  width: 100%; max-width: 420px;
  box-shadow: rgba(0,0,0,0.4) 0 20px 60px;
}
.login-card__logo {
  text-align: center; margin-bottom: 32px;
}
.login-card__logo-text {
  font-size: 21px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.374px;
}
.login-card__sub {
  font-size: 14px; color: var(--ink48); margin-top: 4px; letter-spacing: -0.224px;
}
.login-card__title {
  font-size: 28px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.374px; margin-bottom: 28px; text-align: center;
}

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-layout {
  display: flex; min-height: 100vh;
}

.admin-sidebar {
  width: 240px; min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 100; overflow-y: auto;
  transition: transform .3s;
}
.admin-sidebar__header {
  padding: 20px 20px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
}
.admin-sidebar__logo {
  font-size: 15px; font-weight: 600; color: var(--white);
  letter-spacing: -0.374px; padding-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.admin-sidebar__logo-icon {
  width: 32px; height: 32px; border-radius: var(--radius-btn);
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.admin-sidebar__logo-icon svg { width: 18px; height: 18px; fill: var(--white); }

.admin-nav { list-style: none; padding: 8px 12px; flex: 1; }
.admin-nav__item { margin-bottom: 2px; }
.admin-nav__link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-btn);
  color: rgba(255,255,255,0.6); font-size: 14px; font-weight: 400;
  letter-spacing: -0.224px; text-decoration: none;
  transition: background .15s, color .15s;
}
.admin-nav__link:hover { background: rgba(255,255,255,0.08); color: var(--white); text-decoration: none; }
.admin-nav__link.active { background: var(--blue); color: var(--white); }
.admin-nav__link svg { width: 16px; height: 16px; flex-shrink: 0; }

.admin-nav__section {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.28);
  letter-spacing: 0.8px; text-transform: uppercase;
  padding: 16px 12px 4px;
}

.admin-sidebar__footer {
  padding: 12px; border-top: 1px solid rgba(255,255,255,0.08);
}
.admin-sidebar__user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-btn);
}
.admin-sidebar__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: var(--white);
  flex-shrink: 0;
}
.admin-sidebar__username {
  font-size: 13px; font-weight: 600; color: var(--white); letter-spacing: -0.224px;
}
.admin-sidebar__role {
  font-size: 11px; color: rgba(255,255,255,0.4); letter-spacing: 0;
}
.admin-sidebar__logout {
  display: block; margin-top: 6px; padding: 8px 12px;
  border-radius: var(--radius-btn); font-size: 13px;
  color: rgba(255,255,255,0.5); letter-spacing: -0.224px;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.admin-sidebar__logout:hover { background: rgba(255,59,48,0.15); color: #ff3b30; text-decoration: none; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.admin-main {
  margin-left: 240px; flex: 1;
  display: flex; flex-direction: column; min-height: 100vh;
}

.admin-topbar {
  height: 56px; background: var(--white);
  border-bottom: 1px solid var(--ink08);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.admin-topbar__title {
  font-size: 17px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.374px;
}
.admin-topbar__actions { display: flex; gap: 10px; align-items: center; }

.admin-topbar__hamburger {
  display: none; flex-direction: column; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.admin-topbar__hamburger span {
  display: block; width: 20px; height: 1.5px; background: var(--ink);
  border-radius: 2px;
}

.admin-content {
  padding: 24px; flex: 1;
}

/* ============================================================
   DASHBOARD CARDS
   ============================================================ */
.dash-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}
.dash-card {
  background: var(--white);
  border: 1px solid var(--ink08);
  border-radius: var(--radius-card);
  padding: 20px;
}
.dash-card__label {
  font-size: 12px; font-weight: 600; color: var(--ink48);
  letter-spacing: 0.2px; text-transform: uppercase;
  margin-bottom: 8px;
}
.dash-card__value {
  font-size: 32px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.28px; line-height: 1.1;
}
.dash-card__change {
  font-size: 12px; color: var(--ink48); margin-top: 6px;
  letter-spacing: -0.12px;
}
.dash-card__change--up   { color: #34c759; }
.dash-card__change--down { color: #ff3b30; }

/* ============================================================
   PANEL / SECTION
   ============================================================ */
.admin-panel {
  background: var(--white);
  border: 1px solid var(--ink08);
  border-radius: var(--radius-card);
  overflow: hidden; margin-bottom: 24px;
}
.admin-panel__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ink08);
  display: flex; align-items: center; justify-content: space-between;
}
.admin-panel__title {
  font-size: 15px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.374px;
}
.admin-panel__body { padding: 20px; }

/* ============================================================
   ADMIN TABLE
   ============================================================ */
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.admin-table th {
  padding: 10px 14px; text-align: left; font-weight: 600;
  color: var(--ink48); letter-spacing: -0.224px;
  border-bottom: 1px solid var(--ink08);
  background: var(--parchment); white-space: nowrap;
  font-size: 12px; text-transform: uppercase;
}
.admin-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--ink04);
  color: var(--ink); letter-spacing: -0.224px;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(245,245,247,0.7); }

.table-wrap { overflow-x: auto; }

/* ============================================================
   FORM CONTROLS (admin)
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--ink); margin-bottom: 6px; letter-spacing: -0.224px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  font-family: var(--font); font-size: 15px;
  color: var(--ink); background: var(--white);
  border: 1px solid var(--ink08); border-radius: var(--radius-btn);
  outline: none; transition: border-color .2s, box-shadow .2s;
  letter-spacing: -0.374px; appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,102,204,0.15);
}
.form-textarea { min-height: 90px; resize: vertical; line-height: 1.47; }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238e8e93' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}
.form-hint {
  font-size: 12px; color: var(--ink48); margin-top: 4px;
  letter-spacing: -0.12px;
}

/* ============================================================
   BUTTONS (admin)
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-btn);
  font-family: var(--font); font-size: 14px; font-weight: 400;
  letter-spacing: -0.224px; cursor: pointer; border: none;
  transition: background .15s, transform .1s; text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn:focus-visible { outline: 2px solid var(--blue-focus); outline-offset: 2px; }

.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: #0055b3; text-decoration: none; color: var(--white); }

.btn-secondary { background: var(--parchment); color: var(--ink); border: 1px solid var(--ink08); }
.btn-secondary:hover { background: #ebebed; text-decoration: none; color: var(--ink); }

.btn-danger { background: #ff3b30; color: var(--white); }
.btn-danger:hover { background: #e0352b; text-decoration: none; color: var(--white); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-icon svg { width: 15px; height: 15px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block; padding: 3px 8px;
  border-radius: 4px; font-size: 11px; font-weight: 600;
  letter-spacing: 0; white-space: nowrap;
}
.badge--wait   { background: rgba(255,159,10,0.12); color: #a06200; }
.badge--going  { background: rgba(0,102,204,0.10);  color: var(--blue); }
.badge--done   { background: rgba(52,199,89,0.12);  color: #1a7a38; }
.badge--cancel { background: rgba(142,142,147,0.12);color: #636366; }
.badge--online { background: rgba(52,199,89,0.12);  color: #1a7a38; }
.badge--busy   { background: rgba(255,159,10,0.12); color: #a06200; }
.badge--offline{ background: rgba(142,142,147,0.12);color: #636366; }

/* ============================================================
   MODAL (admin)
   ============================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 2000;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white); border-radius: var(--radius-card);
  padding: 24px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: rgba(0,0,0,0.25) 0 12px 40px;
}
.modal-box__title {
  font-size: 17px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.374px; margin-bottom: 20px;
  padding-bottom: 16px; border-bottom: 1px solid var(--ink08);
}
.modal-box__actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--ink08);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 10px 14px; border-radius: var(--radius-btn);
  font-size: 13px; margin-bottom: 16px; letter-spacing: -0.224px;
}
.alert--success { background: rgba(52,199,89,0.12); color: #1a7a38; border: 1px solid rgba(52,199,89,0.3); }
.alert--error   { background: rgba(255,59,48,0.10);  color: #c0392b; border: 1px solid rgba(255,59,48,0.2); }
.alert--info    { background: rgba(0,102,204,0.08);  color: var(--blue); border: 1px solid rgba(0,102,204,0.2); }

/* ============================================================
   UPLOAD AREA
   ============================================================ */
.upload-area {
  border: 2px dashed var(--ink08); border-radius: var(--radius-card);
  padding: 32px 20px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--blue); background: rgba(0,102,204,0.04);
}
.upload-area__text { font-size: 14px; color: var(--ink48); letter-spacing: -0.224px; }
.upload-area__sub  { font-size: 12px; color: var(--ink48); margin-top: 4px; }
.upload-preview {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px;
}
.upload-preview__item {
  position: relative; width: 80px; height: 80px;
  border-radius: var(--radius-btn); overflow: hidden;
  border: 1px solid var(--ink08);
}
.upload-preview__item img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview__remove {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.5); color: var(--white);
  border: none; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}

/* ============================================================
   STATUS SELECT
   ============================================================ */
.status-select-group {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.status-option {
  position: relative;
}
.status-option input[type="radio"] {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.status-option label {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-btn);
  border: 1px solid var(--ink08); cursor: pointer;
  font-size: 14px; font-weight: 400; color: var(--ink);
  transition: border-color .15s, background .15s;
}
.status-option input:checked + label {
  border-color: var(--blue); background: rgba(0,102,204,0.06);
  font-weight: 600;
}
.status-dot {
  width: 10px; height: 10px; border-radius: 50; display: inline-block;
}
.status-dot--online  { background: #34c759; }
.status-dot--busy    { background: #ff9f0a; }
.status-dot--offline { background: #8e8e93; }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 90;
}
.sidebar-overlay.open { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1068px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 833px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main { margin-left: 0; }
  .admin-topbar__hamburger { display: flex; }
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-content { padding: 16px; }
}

@media (max-width: 640px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 32px 20px; }
  .modal-box { padding: 16px; }
  .admin-table th:nth-child(n+5), .admin-table td:nth-child(n+5) { display: none; }
  .modal-box__actions { flex-direction: column; }
  .modal-box__actions .btn { width: 100%; }
  .status-select-group { flex-direction: column; }
  .status-option label { justify-content: center; }
}

@media (max-width: 419px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card__value { font-size: 24px; }
}
