/* SINKWOOD Admin — refined wood-atelier dashboard */
:root {
  --ink: #1c1916;
  --ink-soft: #3d3832;
  --muted: #7a7268;
  --line: #e6e0d6;
  --paper: #faf7f2;
  --paper-2: #f3eee6;
  --panel: #ffffff;
  --sidebar: #1f1c19;
  --sidebar-2: #2a2622;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-hover: #0d9488;
  --brass: #b8956c;
  --danger: #b42318;
  --warn: #c2410c;
  --radius: 12px;
  --shadow: 0 18px 50px rgba(28, 25, 22, 0.08);
  --font: "Outfit", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --display: "Cormorant Garamond", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  letter-spacing: -0.01em;
}

[hidden] { display: none !important; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

a { color: var(--accent); }

/* ---------- Login ---------- */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(184,149,108,.18), transparent 55%),
    radial-gradient(700px 400px at 100% 100%, rgba(15,118,110,.12), transparent 50%),
    linear-gradient(160deg, #f7f2ea 0%, #ebe4d8 100%);
}

.login-shell {
  width: min(420px, 100%);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 36px 32px 28px;
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  background: linear-gradient(145deg, #2f2a25, #1a1714);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

.brand-mark.sm {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--brass);
  font-weight: 600;
}

.login-brand h1 {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.1;
}

.login-brand .sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.login-form label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.login-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 14px;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,118,110,.12);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  padding: 9px 14px;
  cursor: pointer;
  transition: .15s ease;
  font-weight: 500;
}

.btn:hover { background: var(--paper-2); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn.ghost {
  background: transparent;
  border-color: rgba(255,255,255,.14);
  color: #d6d0c7;
}
.btn.ghost:hover { background: rgba(255,255,255,.06); color: #fff; }

.btn.sm { padding: 6px 11px; font-size: 0.86rem; }
.btn.block { width: 100%; padding: 12px; font-size: 0.98rem; }

.icon-btn {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
}

/* ---------- Admin shell ---------- */
.admin-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, #161310 100%);
  color: #ebe6df;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand strong {
  display: block;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.sidebar-brand span {
  display: block;
  font-size: 0.75rem;
  color: #9b948a;
  margin-top: 2px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #cfc7bb;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: .15s ease;
}

.nav-btn:hover { background: rgba(255,255,255,.05); color: #fff; }

.nav-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(15,118,110,.28);
}

.nav-ico {
  width: 1.2em;
  opacity: .9;
  font-size: 0.95rem;
}

.sidebar-foot {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-foot a {
  color: #9b948a;
  font-size: 0.82rem;
  text-decoration: none;
}
.sidebar-foot a:hover { color: #fff; }

.main-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 600;
}

.user-chip {
  font-size: 0.88rem;
  color: var(--muted);
}
.user-chip b { color: var(--ink-soft); }

.content {
  padding: 22px 28px 40px;
}

/* ---------- Filters ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.filter-bar input,
.filter-bar select,
.input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  min-width: 0;
}

.filter-bar input { width: 120px; }
.filter-bar select { min-width: 110px; }

.filter-bar input:focus,
.filter-bar select:focus,
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,118,110,.1);
}

.date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.date-range input { width: 140px; }

/* ---------- Tables ---------- */
.table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 980px;
}

.data-table th {
  background: linear-gradient(180deg, #5f6f86 0%, #536278 100%);
  color: #fff;
  font-weight: 600;
  padding: 11px 10px;
  text-align: center;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.08);
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  background: #fff;
}

.data-table tbody tr:nth-child(even) td { background: #fcfaf7; }
.data-table tbody tr:hover td { background: #f0faf8; }

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .center { text-align: center; }
.data-table .left { text-align: left; }
.data-table .w-check { width: 36px; }

.data-table a.order-link {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: underline;
}

.status-pill {
  display: inline-block;
  font-weight: 600;
  font-size: 0.82rem;
  color: #e11d48;
}

.data-table tfoot td {
  background: #f5f1ea;
  font-weight: 600;
  padding: 12px 10px;
}
.sum-label { text-align: center; }

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.act {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #2563eb;
  font-size: 0.95rem;
  padding: 2px 4px;
}
.act.danger { color: #dc2626; }
.act:hover { opacity: .75; }

.note-cell {
  max-width: 180px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.mall-cell {
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: pre-line;
}

.date-cell {
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: pre-line;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- Pager ---------- */
.pager {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.pager button {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
}
.pager button.active {
  background: #334155;
  border-color: #334155;
  color: #fff;
}
.pager button:hover:not(.active) { background: var(--paper-2); }

/* ---------- Settings ---------- */
.settings-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.field-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-bottom: 1px solid var(--line);
}

.field-row > label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 12px;
  background: #f3efe7;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  border-right: 1px solid var(--line);
}

.field-body { padding: 12px 14px; }
.field-body .input { width: 100%; }
.field-body textarea.input { resize: vertical; min-height: 80px; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding: 18px;
}

/* ---------- Empty ---------- */
.empty-state {
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.4rem;
  color: var(--ink);
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, .45);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: min(480px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
  overflow: hidden;
  max-height: min(90vh, 800px);
  display: flex;
  flex-direction: column;
}

.modal-card.wide { width: min(640px, 100%); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #faf7f2;
}

.modal-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
}

.modal-body {
  padding: 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-body > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 500;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--muted);
}
.range-row span { min-width: 36px; }
.input.sm { width: 80px; padding: 7px 8px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid-2 label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.check-label {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  color: var(--ink) !important;
}

.modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 8px;
}

/* ---------- Alerts / status ---------- */
.alert.error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  font-size: 0.86rem;
}

.status-line {
  margin: 0;
  font-size: 0.86rem;
  color: var(--accent);
  font-weight: 500;
}
.status-line.error { color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .admin-view {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
  }
  .side-nav {
    flex-direction: row;
    overflow-x: auto;
  }
  .nav-btn {
    white-space: nowrap;
  }
  .sidebar-foot { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 14px 16px; }
  .field-row { grid-template-columns: 1fr; }
  .field-row > label {
    justify-content: flex-start;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .grid-2 { grid-template-columns: 1fr; }
}
