/* ==========================================================================
   Dandi Art · Vận hành — Design System
   Tông màu thương hiệu từ Logo:
   - Cam Dandi: #f79420 (Vivid warm orange)
   - Vàng Dandi: #ffcb04 (Sunny gold accent)
   - Ngọc Dandi: #00ab80 (Fresh emerald teal)
   - San hô Dandi: #ef4f5e (Warm coral red)
   ========================================================================== */

:root {
  /* Tông màu thương hiệu */
  --brand: #f79420;
  --brand-hover: #e68310;
  --brand-active: #d67406;
  --brand-light: #fff5e8;
  --brand-tint: #fffaee;
  --brand2: #ffcb04;
  
  /* Màu trạng thái & phân loại cơ sở */
  --ok: #00ab80;
  --ok-bg: #e6f7f2;
  --ok-text: #008262;
  --warn: #e88d17;
  --warn-bg: #fff3e2;
  --warn-text: #a85800;
  --danger: #ef4f5e;
  --danger-bg: #fdecee;
  --danger-text: #cf3342;

  /* Cơ sở */
  --hvt-bg: #eaf2ff;
  --hvt-text: #1a5bb0;
  --hvt-border: #c8deff;
  --q7-bg: #fff0f0;
  --q7-text: #bd2735;
  --q7-border: #ffd5d8;

  /* Nền và bề mặt (ấm áp, tinh tế như giấy vẽ mỹ thuật) */
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #1e1b26;
  --ink-soft: #383445;
  --muted: #6e697a;
  --muted-light: #9c96a6;
  --line: #ede7df;
  --line-light: #f4efe8;

  /* Hình học & Bóng */
  --radius-sm: 8px;
  --radius: 13px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(35, 25, 15, 0.04), 0 1px 2px rgba(35, 25, 15, 0.02);
  --shadow: 0 4px 14px rgba(35, 25, 15, 0.05), 0 1px 3px rgba(35, 25, 15, 0.03);
  --shadow-md: 0 8px 22px rgba(35, 25, 15, 0.08), 0 2px 6px rgba(35, 25, 15, 0.04);
  --shadow-brand: 0 4px 14px rgba(247, 148, 32, 0.28);

  /* Phông chữ */
  --font-display: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Header Top Bar
   ========================================================================== */
header.top {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(30, 20, 10, 0.03);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand .logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 5px rgba(247, 148, 32, 0.25));
}

.brand .logo {
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.brand b {
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tag {
  background: linear-gradient(135deg, var(--brand) 0%, #ff9e36 100%);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 2.5px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(247, 148, 32, 0.25);
  display: inline-block;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-display);
  text-decoration: none;
  background: var(--brand-light);
  color: #bd5e00;
  border: 1px solid rgba(247, 148, 32, 0.22);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.nav-switch-btn:hover {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
}

.nav-switch-btn.outline {
  background: #ffffff;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.nav-switch-btn.outline:hover {
  background: var(--line-light);
  border-color: #d6ccbe;
}

.who {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

.chip {
  background: #fff8ee;
  color: #a85200;
  border: 1px solid #fedfae;
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.chip::before {
  content: "●";
  color: var(--ok);
  font-size: 10px;
  line-height: 1;
}

#lo {
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 3px 5px;
  border-radius: 4px;
  transition: color 0.15s ease;
  white-space: nowrap;
}

#lo:hover {
  color: var(--danger);
}

/* ==========================================================================
   Main Layout & Sub-header
   ========================================================================== */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 14px 44px;
  display: grid;
  gap: 14px;
}

.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 4px 0;
}

.meta-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: -0.01em;
}

.meta {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

/* ==========================================================================
   Dashboard Stat Cards (.cards, .card)
   ========================================================================== */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 640px) {
  .cards {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 14px 13px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #dfd4c7;
}

.card .n {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.card .l {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  line-height: 1.35;
}

/* ==========================================================================
   Panels (.panel)
   ========================================================================== */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 15px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.25s ease-out;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.panel-head h2 {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.panel-head h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  background: linear-gradient(180deg, var(--brand), var(--brand2));
  border-radius: 4px;
}

/* ==========================================================================
   Status Pills (.pill)
   ========================================================================== */
.pill {
  margin-left: auto;
  background: #f4efe9;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 3.5px 11px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pill.ok {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: #bfe8db;
}

.pill.warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: #fce0bc;
}

.pill.danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #fad1d5;
}

/* ==========================================================================
   Lists & Rows (.list, .row)
   ========================================================================== */
.list {
  display: grid;
  gap: 9px;
}

.row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(30, 20, 10, 0.02);
  transition: all 0.15s ease;
  position: relative;
}

.row:hover {
  border-color: #dcd2c4;
  background: #fdfcf9;
}

.row .t {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.35;
}

.row .s {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
  line-height: 1.45;
}

.row .badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 7px;
  background: #efebe4;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.row .badge.hvt {
  background: var(--hvt-bg);
  color: var(--hvt-text);
  border: 1px solid var(--hvt-border);
}

.row .badge.q7 {
  background: var(--q7-bg);
  color: var(--q7-text);
  border: 1px solid var(--q7-border);
}

/* ==========================================================================
   Search Input (.search)
   ========================================================================== */
.search {
  width: 100%;
  padding: 12px 15px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  background: #faf8f5;
  color: var(--ink);
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
  -webkit-appearance: none;
}

.search:focus {
  background: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(247, 148, 32, 0.18);
}

.search::placeholder {
  color: var(--muted-light);
}

/* ==========================================================================
   Tabs Navigation (.tabs)
   ========================================================================== */
.tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 1px 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: var(--radius-full);
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 40px;
}

.tabs button:hover {
  color: var(--ink);
  border-color: #d8cebf;
  background: #faf8f5;
}

.tabs button[aria-selected="true"] {
  background: linear-gradient(135deg, var(--brand) 0%, #ff9e36 100%);
  color: #ffffff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: var(--shadow-brand);
}

.tabs button:active {
  transform: scale(0.97);
}

/* ==========================================================================
   Form Fields (.field, label, input, select, textarea)
   ========================================================================== */
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  font-family: var(--font-display);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px; /* >= 15px để tránh iOS tự zoom */
  background: #faf8f5;
  color: var(--ink);
  font-family: var(--font-body);
  transition: all 0.2s ease;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  min-height: 46px;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e697a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 38px;
}

.field textarea {
  min-height: 100px;
  line-height: 1.5;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  background: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(247, 148, 32, 0.18);
}

.field input[type="file"] {
  background: #ffffff;
  border: 1.5px dashed var(--line);
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  min-height: 46px;
  display: flex;
  align-items: center;
}

.field input[type="file"]::file-selector-button {
  border: 0;
  background: var(--brand-light);
  color: #bd5e00;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  margin-right: 12px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 12.5px;
  transition: background 0.15s ease;
}

.field input[type="file"]::file-selector-button:hover {
  background: var(--brand);
  color: #ffffff;
}

/* ==========================================================================
   Action Buttons (.btn, .btn.ghost, .btn.ok, .btn.warn, .row2)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius);
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-display);
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand) 0%, #ff9e36 100%);
  width: 100%;
  cursor: pointer;
  box-shadow: var(--shadow-brand);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(247, 148, 32, 0.35);
}

.btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(247, 148, 32, 0.2);
}

.btn.ghost {
  background: #ffffff;
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.btn.ghost:hover {
  background: #faf8f5;
  border-color: #d6ccbe;
  color: var(--ink);
}

.btn.ok {
  background: linear-gradient(135deg, var(--ok) 0%, #08c494 100%);
  box-shadow: 0 4px 14px rgba(0, 171, 128, 0.28);
}

.btn.ok:hover {
  box-shadow: 0 6px 18px rgba(0, 171, 128, 0.36);
}

.btn.ok:active {
  box-shadow: 0 2px 6px rgba(0, 171, 128, 0.2);
}

.btn.warn {
  background: linear-gradient(135deg, var(--danger) 0%, #f76875 100%);
  box-shadow: 0 4px 14px rgba(239, 79, 94, 0.28);
}

.btn.warn:hover {
  box-shadow: 0 6px 18px rgba(239, 79, 94, 0.36);
}

.btn.warn:active {
  box-shadow: 0 2px 6px rgba(239, 79, 94, 0.2);
}

.row2 {
  display: flex;
  gap: 10px;
}

.row2 > * {
  flex: 1;
}

/* ==========================================================================
   State & Utility Classes
   ========================================================================== */
.empty {
  color: var(--muted);
  font-size: 13.5px;
  padding: 16px 14px;
  text-align: center;
  background: #faf8f5;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  margin: 4px 0;
}

.hide {
  display: none !important;
}

footer {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 36px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.5;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive fine-tuning */
@media (max-width: 480px) {
  header.top {
    padding: 10px 12px;
  }
  .brand {
    font-size: 16px;
  }
  .brand .logo-img {
    width: 28px;
    height: 28px;
  }
  .tag {
    font-size: 10px;
    padding: 2px 7px;
  }
  main {
    padding: 12px 10px 36px;
    gap: 12px;
  }
  .card {
    padding: 12px 11px;
  }
  .card .n {
    font-size: 26px;
  }
  .card .l {
    font-size: 11.5px;
  }
  .panel {
    padding: 14px 12px;
  }
  .tabs button {
    padding: 8px 13px;
    font-size: 13px;
  }
}
