/* =====================================================================
   KMS — Reading Room theme
   Sidebar tinta gelap, kanvas kertas hangat, aksen tunggal hijau-teal.
   ===================================================================== */

:root {
  --ink:       #16201d;   /* tinta gelap sidebar */
  --ink-soft:  #24322d;
  --paper:     #f6f4ee;   /* kertas hangat */
  --paper-card:#fffdf8;
  --line:      #e2ddd0;
  --text:      #23282a;
  --text-dim:  #6b7570;
  --accent:    #0f8b6c;   /* teal-hijau, satu-satunya aksen */
  --accent-ink:#0a5f4a;
  --danger:    #b4472f;
  --shadow:    0 1px 2px rgba(20,30,25,.05), 0 8px 24px rgba(20,30,25,.06);
  --radius:    12px;
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

/* ---------- Layout shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--ink);
  color: #d6ddd8;
  display: flex;
  flex-direction: column;
  padding: 26px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-family: 'Sora', sans-serif; font-weight: 700; font-size: 20px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: 'Sora', sans-serif; color: #fff; font-size: 15px; }
.brand-text span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #7d8b85; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  padding: 10px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: #b7c1bc;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--ink-soft); color: #fff; }
.nav-item--accent {
  margin-top: 10px; background: var(--accent); color: #fff;
}
.nav-item--accent:hover { background: var(--accent-ink); color: #fff; }

.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 16px; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink-soft); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 14px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-size: 13px; color: #e6ebe8; font-weight: 500; }
.user-role { font-size: 11px; color: #7d8b85; text-transform: capitalize; }
.logout { font-size: 13px; color: #97a39d; }
.logout:hover { color: #fff; }

.content { flex: 1; padding: 40px 48px; max-width: 1100px; }

/* ---------- Typography ---------- */
h1 { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 28px; letter-spacing: -.01em; }
h2 { font-family: 'Sora', sans-serif; font-weight: 600; font-size: 20px; margin-bottom: 4px; }
.page-head { margin-bottom: 28px; }
.page-head p { color: var(--text-dim); font-size: 15px; margin-top: 4px; }
.eyebrow {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink); font-weight: 600; margin-bottom: 6px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.grid { display: grid; gap: 16px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

/* product card */
.product-card { padding: 20px; display: flex; flex-direction: column; gap: 8px; transition: transform .15s, box-shadow .15s; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(20,30,25,.1); }
.product-card h2 { font-size: 17px; }
.product-card .count { font-size: 13px; color: var(--text-dim); }
.product-card .desc { font-size: 13px; color: var(--text-dim); }

/* entry list */
.entry {
  padding: 18px 20px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px;
}
.entry:last-child { border-bottom: none; }
.entry-title {
  font-family: 'Sora', sans-serif; font-weight: 600; font-size: 16px;
  color: var(--text);
}
.entry:hover .entry-title { color: var(--accent-ink); }
.entry-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; }
.entry-excerpt { font-size: 14px; color: var(--text-dim); }

.chip {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: #fff;
}
.pin { color: var(--accent); font-weight: 600; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.input, .select, textarea {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fff; font-size: 14px; font-family: inherit; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,139,108,.12);
}
.row { display: flex; gap: 16px; }
.row > * { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 9px; border: none;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn--danger { background: var(--danger); color: #fff; }

/* ---------- Search ---------- */
.searchbar { display: flex; gap: 12px; margin-bottom: 20px; }
.searchbar .input { flex: 1; }
.filters { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.filters .select { max-width: 220px; }

/* ---------- Article view ---------- */
.article { padding: 34px 40px; }
.article h1 { margin-bottom: 8px; }
.article-body { font-size: 15.5px; line-height: 1.7; color: #2b302f; margin-top: 22px; }
.article-body h1, .article-body h2, .article-body h3 { font-family: 'Sora', sans-serif; margin: 22px 0 8px; }
.article-body p { margin-bottom: 14px; }
.article-body img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); margin: 8px 0; }
.article-body ul, .article-body ol { margin: 0 0 14px 22px; }
.article-body pre { background: var(--ink); color: #e6ebe8; padding: 14px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
.article-body code { background: #eceae1; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.article-body blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--text-dim); margin: 0 0 14px; }
.article-body table { border-collapse: collapse; width: 100%; margin-bottom: 14px; }
.article-body th, .article-body td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; font-size: 14px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 9px; font-size: 14px; margin-bottom: 18px; }
.alert--error { background: #fbeae6; color: var(--danger); border: 1px solid #f0cabd; }
.alert--ok { background: #e6f4ef; color: var(--accent-ink); border: 1px solid #bfe3d6; }
.alert--info { background: #eef0fb; color: #3a4a9e; border: 1px solid #cdd4f2; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty strong { display: block; font-family: 'Sora', sans-serif; font-size: 18px; color: var(--text); margin-bottom: 6px; }

/* ---------- Table (admin) ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--paper-card); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 12px 16px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--line); }
.table th { background: #efece3; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.table tr:last-child td { border-bottom: none; }

/* ---------- Login ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 30% -10%, #24322d, var(--ink));
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--paper-card);
  border-radius: 16px; padding: 40px 36px; box-shadow: 0 30px 60px rgba(0,0,0,.35);
}
.auth-card .brand-mark { margin: 0 auto 18px; width: 48px; height: 48px; font-size: 24px; }
.auth-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--text-dim); font-size: 14px; margin-bottom: 26px; }
.auth-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- Utilities ---------- */
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.muted { color: var(--text-dim); }
.small { font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px; }
  .brand { margin-bottom: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .sidebar-foot { border-top: none; padding-top: 0; display: flex; align-items: center; gap: 16px; }
  .content { padding: 24px 18px; }
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* keyboard focus visibility */
a:focus-visible, button:focus-visible, .input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
