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

:root {
  --bg: #FAF7F0;
  --panel: #FFFFFF;
  --ink: #2A2A22;
  --ink-soft: #6B6656;
  --muted: #8C8672;
  --line: #E5E0D3;
  --brand: #AE8D69;
  --brand-dark: #112138;
  --brand-light: #F3EFE7;
  --clay: #B65C38;
  --clay-light: #F6E7DF;
  --gold: #B98E3D;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-family: 'Inter', sans-serif; color: var(--ink); }
.font-display { font-family: 'Fraunces', serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; outline: none; }
table { border-collapse: collapse; width: 100%; }

.shell { display: flex; flex-direction: column; min-height: 100vh; }
@media (min-width: 640px) { .shell { flex-direction: row; } }
.sidebar { background: var(--brand-dark); padding: 18px 14px; display: flex; gap: 4px; }
@media (min-width: 640px) { .sidebar { flex-direction: column; width: 220px; min-height: 100vh; padding: 32px 16px; } }
.brand { display: none; align-items: center; gap: 8px; padding: 0 8px; margin-bottom: 32px; }
@media (min-width: 640px) { .brand { display: flex; } }
.brand-badge-img { width: 34px; height: auto; object-fit: contain; }
.mobile-badge { display: block; }
@media (min-width: 640px) { .mobile-badge { display: none; } }
.mobile-badge-img { width: 30px; height: auto; object-fit: contain; align-self: center; margin-right: 4px; }
.brand-name { font-size: 16px; font-weight: 600; color: #fff; }
.navbtn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.65); transition: background .15s, color .15s; }
.navbtn.active { background: rgba(255,255,255,0.14); color: #fff; }
.navbtn span.label { display: none; }
@media (min-width: 640px) { .navbtn span.label { display: inline; } }
.main { flex: 1; padding: 22px 18px; max-width: 960px; }
@media (min-width: 640px) { .main { padding: 40px 44px; } }
.sidebar-spacer { flex: 1; display: none; }
@media (min-width: 640px) { .sidebar-spacer { display: block; } }
.sidebar-user { display: none; flex-direction: column; gap: 2px; padding: 10px 12px 0; border-top: 1px solid rgba(255,255,255,0.12); margin-top: 8px; }
@media (min-width: 640px) { .sidebar-user { display: flex; } }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; margin: 8px 0 0; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.55); margin: 0 0 6px; }

h2.page-title { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 600; margin: 0; color: var(--ink); }
.subtle { color: var(--muted); font-size: 13px; }

.btn { font-size: 14px; font-weight: 600; padding: 10px 16px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; transition: filter .15s; }
.btn:hover { filter: brightness(1.05); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-secondary { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: var(--clay-light); color: var(--clay); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { padding: 6px; border-radius: 6px; display: inline-flex; }
.icon-btn:hover { background: rgba(0,0,0,0.05); }

.field-label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font-size: 14px; padding: 10px 12px; border-radius: 8px; transition: box-shadow .15s, border-color .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
.grid-4 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.data-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.data-table table { width: 100%; }
.data-table thead tr { background: var(--brand-light); }
.data-table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-dark); padding: 10px 14px; }
.data-table td { padding: 10px 14px; font-size: 14px; border-top: 1px solid var(--line); }
.data-table tbody tr:first-child td { border-top: none; }
.data-table tbody tr:hover { background: #FCFBF8; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 4px 10px; border-radius: 999px; }

.overlay { position: fixed; inset: 0; background: rgba(42,42,34,0.4); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 480px; background: var(--panel); border-radius: 16px; padding: 24px; max-height: 85vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-title { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 600; }

.empty { border: 1px dashed var(--line); border-radius: 16px; padding: 64px 20px; text-align: center; }
.empty p.title { font-size: 14px; font-weight: 600; margin: 8px 0 2px; }
.empty p.sub { font-size: 12px; color: var(--muted); margin: 0; }

.li-table input { border: none; background: transparent; width: 100%; font-size: 14px; padding: 6px; }
.li-table input:focus { background: var(--brand-light); border-radius: 6px; }

.sheet { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 40px; max-width: 720px; margin: 0 auto; }
.sheet .items-table th { border-bottom: 2px solid var(--brand-dark); text-transform: uppercase; letter-spacing: .04em; font-size: 11px; font-weight: 600; color: var(--brand-dark); text-align: left; padding-bottom: 8px; }
.sheet .items-table td { border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 14px; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-title { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; text-align: center; margin: 0 0 4px; }
.auth-sub { font-size: 13px; color: var(--muted); text-align: center; margin: 0 0 24px; }
.auth-error { background: var(--clay-light); color: var(--clay); font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; }

@media print {
  .no-print { display: none !important; }
  .sidebar { display: none !important; }
  body { background: #fff; }
  .sheet { border: none; padding: 0; max-width: 100%; }
}
