@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Palette: ağır perde kadifesi + pirinç korniş + keten zemin */
  --ink: #1E2A24;
  --pine: #2A3B34;
  --pine-2: #35493F;
  --brass: #B08D57;
  --brass-light: #D8BD8B;
  --linen: #F3F5EF;
  --linen-2: #ECEEE4;
  --card: #FFFFFF;
  --line: #DEE2D6;
  --muted: #6B7A70;

  --success: #4C7A6B;
  --success-bg: #E7F0EB;
  --warning: #C9822F;
  --warning-bg: #FBEDDC;
  --danger: #B5533C;
  --danger-bg: #F8E7E1;
  --info: #4C6E8C;
  --info-bg: #E6EEF4;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(30, 42, 36, 0.06), 0 8px 24px -12px rgba(30, 42, 36, 0.18);
  --shadow-lg: 0 20px 50px -20px rgba(30, 42, 36, 0.35);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--linen);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; color: var(--pine); }
p { margin: 0; }
a { color: inherit; }
button { font-family: var(--font-body); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- Pleat divider: imza öğesi — kıvrımlı perde pilisi --- */
.pleat {
  height: 14px;
  width: 100%;
  background:
    repeating-linear-gradient(
      100deg,
      var(--brass) 0px, var(--brass) 2px,
      transparent 2px, transparent 26px
    );
  opacity: 0.55;
  mask-image: linear-gradient(180deg, black, transparent);
}
.pleat-thin {
  height: 3px;
  background: linear-gradient(90deg, var(--brass) 0%, var(--brass-light) 50%, var(--brass) 100%);
  border-radius: 2px;
}

/* --- Layout shell --- */
.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--pine);
  color: #EDEFE8;
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 18px;
}
.sidebar .brand svg { flex-shrink: 0; }
.sidebar .brand-text { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: #fff; line-height: 1.15; }
.sidebar .brand-text small { display: block; font-family: var(--font-body); font-size: 0.68rem; font-weight: 500; color: var(--brass-light); letter-spacing: 0.06em; text-transform: uppercase; }
.sidebar-pleat { margin: 4px 0 16px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-list a {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: #C9D2CB;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-list a svg { flex-shrink: 0; opacity: 0.85; }
.nav-list a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-list a.active { background: var(--brass); color: var(--pine); font-weight: 600; }
.nav-list a.active svg { opacity: 1; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 12px; margin-top: 8px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.sidebar-user .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brass);
  color: var(--pine); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.sidebar-user .info { min-width: 0; }
.sidebar-user .name { font-size: 0.85rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .email { font-size: 0.72rem; color: #9FABA2; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
  width: 100%; margin-top: 10px; background: transparent; border: 1px solid rgba(255,255,255,0.18);
  color: #C9D2CB; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.82rem;
  display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.15s;
}
.logout-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--pine);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}
.content { padding: 28px 32px 90px; flex: 1; }
.page-head { margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brass); font-weight: 600; margin-bottom: 4px; display: block; }
.page-head h1 { font-size: 1.7rem; }
.page-head p.sub { color: var(--muted); margin-top: 4px; font-size: 0.92rem; }

.bottom-nav { display: none; }

/* --- Cards --- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  overflow: hidden;
}
.card-pad { padding: 20px 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 18px 20px; position: relative; overflow: hidden; }
.stat-card .stat-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.stat-card .stat-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; color: var(--pine); }
.stat-card .stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 0.88rem; font-weight: 600; padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s; white-space: nowrap;
  font-family: var(--font-body);
}
.btn-primary { background: var(--pine); color: #fff; }
.btn-primary:hover { background: var(--pine-2); }
.btn-brass { background: var(--brass); color: var(--pine); }
.btn-brass:hover { background: var(--brass-light); }
.btn-ghost { background: transparent; color: var(--pine); border-color: var(--line); }
.btn-ghost:hover { background: var(--linen-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { padding: 8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* --- Forms --- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--pine); margin-bottom: 6px; }
.field .hint { font-size: 0.74rem; color: var(--muted); margin-top: 4px; }
input, select, textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  font-size: 0.92rem; font-family: var(--font-body); background: #fff; color: var(--ink); transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brass); outline: none; }
textarea { resize: vertical; min-height: 72px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.error-text { color: var(--danger); font-size: 0.82rem; margin-top: 6px; min-height: 1em; }

/* --- Table --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1.5px solid var(--line); white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--linen-2); vertical-align: middle; }
tbody tr:hover { background: var(--linen); }
tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; color: var(--pine); }
.cell-muted { color: var(--muted); font-size: 0.84rem; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* --- Badge / status pill --- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 0.74rem; font-weight: 600; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* --- Toolbar --- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; justify-content: space-between; }
.search-box { position: relative; max-width: 320px; flex: 1; min-width: 200px; }
.search-box input { padding-left: 36px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* --- Empty state --- */
.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state svg { margin-bottom: 14px; opacity: 0.5; }
.empty-state h3 { color: var(--pine); margin-bottom: 6px; font-size: 1.05rem; }
.empty-state p { font-size: 0.88rem; max-width: 320px; margin: 0 auto; }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(30,42,36,0.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity 0.18s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  max-height: 88vh; display: flex; flex-direction: column; transform: translateY(8px) scale(0.98); transition: transform 0.18s;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 1.15rem; }
.modal-close { background: transparent; border: none; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--linen-2); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* --- Toast --- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--pine); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  font-size: 0.86rem; display: flex; align-items: center; gap: 10px; min-width: 220px; max-width: 320px;
  animation: toast-in 0.22s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* --- Auth pages --- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--linen); }
.auth-visual { background: var(--pine); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px; }
.auth-visual .brand-text { color: #fff; }
.auth-visual .quote { color: #DCE3DA; font-family: var(--font-display); font-size: 1.4rem; line-height: 1.4; max-width: 380px; position: relative; z-index: 2; }
.auth-visual .quote span { color: var(--brass-light); }
.fold-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form-card { width: 100%; max-width: 380px; }
.auth-form-card .eyebrow { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brass); font-weight: 700; }
.auth-form-card h1 { font-size: 1.7rem; margin: 6px 0 6px; }
.auth-form-card .sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 26px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 0.88rem; color: var(--muted); }
.auth-switch a { color: var(--brass); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-alert { background: var(--danger-bg); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 16px; display: none; }
.auth-alert.show { display: block; }

/* --- Order detail --- */
.order-timeline { list-style: none; margin: 0; padding: 0; }
.order-timeline li { display: flex; gap: 14px; padding-bottom: 20px; position: relative; }
.order-timeline li::before { content: ''; position: absolute; left: 7px; top: 22px; bottom: 0; width: 1.5px; background: var(--line); }
.order-timeline li:last-child::before { display: none; }
.order-timeline .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--brass); border: 3px solid var(--linen); flex-shrink: 0; margin-top: 2px; box-shadow: 0 0 0 1px var(--line); }
.order-timeline .tl-status { font-weight: 600; color: var(--pine); font-size: 0.9rem; }
.order-timeline .tl-note { color: var(--muted); font-size: 0.84rem; margin-top: 2px; }
.order-timeline .tl-date { color: var(--muted); font-size: 0.76rem; margin-top: 3px; }

.kv-list { display: flex; flex-direction: column; gap: 12px; }
.kv-list .kv-row { display: flex; justify-content: space-between; gap: 10px; font-size: 0.88rem; }
.kv-list .kv-row .k { color: var(--muted); }
.kv-list .kv-row .v { font-weight: 600; color: var(--pine); text-align: right; }

/* --- Loading --- */
.spinner { width: 20px; height: 20px; border: 2.5px solid rgba(0,0,0,0.1); border-top-color: var(--brass); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--muted); gap: 10px; }

/* --- Responsive --- */
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; }
  .content { padding: 18px 16px 90px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--pine);
    justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 30; box-shadow: 0 -6px 20px rgba(0,0,0,0.15);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none;
    color: #9FAB9F; font-size: 0.62rem; font-weight: 600; padding: 6px 8px; border-radius: 10px; min-width: 56px;
  }
  .bottom-nav a.active { color: var(--brass-light); }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { min-height: 200px; padding: 28px; }
  .auth-visual .quote { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: none; }
}

@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  table thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tbody tr { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; padding: 10px 4px; background: #fff; }
  tbody td { border: none; padding: 6px 12px; display: flex; justify-content: space-between; gap: 10px; text-align: right; }
  tbody td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.03em; text-align: left; }
  .row-actions { justify-content: flex-end; }
  .modal { max-width: 100%; }
}
