/* ================================================================
   KDP Portal — Shared shell styling
   Editorial-refined aesthetic, type-driven, generous whitespace.
   ================================================================ */
:root {
  --bg:        #fafaf7;
  --surface:   #ffffff;
  --ink:       #1a1a1a;
  --muted:     #6b6862;
  --line:      #e8e6e0;
  --line-2:    #d8d5cd;
  --accent:    #7a1f1f;          /* deep maroon, KDP brand-ish */
  --accent-2:  #c89a3a;          /* warm gold */
  --good:      #15803d;
  --warn:      #b45309;
  --bad:       #991b1b;
  --shadow-sm: 0 1px 2px rgba(15,15,15,.05);
  --shadow-md: 0 4px 16px rgba(15,15,15,.07);
  --shadow-lg: 0 12px 36px rgba(15,15,15,.10);
  --r:         8px;
  --r-lg:      14px;
  --header-h:  64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Distinctive type pairing: display serif + clean mono for nav/UI */
.display, h1.display, h2.display {
  font-family: "Fraunces", "Newsreader", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.mono, .kpd-ui, button, input, select, nav, .nav, .badge, .stat-num {
  font-family: "JetBrains Mono", ui-monospace, "Menlo", monospace;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ===== Header ===== */
.kdp-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 18px;
}
.kdp-brand {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--accent);
  display: flex; align-items: center; gap: 10px;
}
.kdp-brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  display: inline-block;
}
.kdp-nav {
  flex: 1; display: flex; gap: 4px; overflow-x: auto;
  font-size: 12.5px; letter-spacing: 0.02em;
}
.kdp-nav a {
  padding: 8px 14px;
  border-radius: var(--r);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: all .15s ease;
}
.kdp-nav a:hover { background: var(--bg); border-color: var(--line); }
.kdp-nav a.active {
  background: var(--ink); color: var(--bg);
  border-color: var(--ink);
}
.kdp-nav a.soon { color: var(--muted); }
.kdp-nav a.soon::after {
  content: "·soon"; margin-left: 6px;
  color: var(--accent-2); font-size: 10px;
}

.kdp-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 12.5px;
  cursor: pointer;
  background: var(--surface);
}
.kdp-user:hover { border-color: var(--line-2); }
.kdp-user .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 11px;
  font-family: "JetBrains Mono", monospace;
}
.kdp-user-menu {
  position: absolute; right: 24px; top: calc(var(--header-h) + 4px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 6px;
  display: none;
  z-index: 100;
}
.kdp-user-menu.open { display: block; }
.kdp-user-menu a, .kdp-user-menu button {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px;
  font-size: 13px;
  border: 0; background: transparent; color: var(--ink);
  border-radius: var(--r);
  cursor: pointer;
  text-decoration: none;
}
.kdp-user-menu a:hover, .kdp-user-menu button:hover {
  background: var(--bg); text-decoration: none;
}
.kdp-user-menu .sep { height: 1px; background: var(--line); margin: 4px 6px; }
.kdp-user-menu .meta {
  padding: 8px 14px; font-size: 11px; color: var(--muted);
  border-bottom: 1px solid var(--line); margin-bottom: 4px;
}

/* ===== Main content ===== */
.kdp-main {
  max-width: 1400px; margin: 0 auto;
  padding: 32px 24px 64px;
}
.kdp-page-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 28px; gap: 24px;
}
.kdp-page-title h1 {
  margin: 0; font-size: 36px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.kdp-page-title .crumb {
  font-size: 11.5px;
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ===== Card / surface ===== */
.kdp-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.kdp-card + .kdp-card { margin-top: 16px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
}
.btn:hover { background: var(--bg); border-color: var(--muted); text-decoration: none; }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: white; }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: white; }
.btn-sm { padding: 6px 12px; font-size: 11.5px; }

/* ===== Inputs ===== */
.input, input[type="text"], input[type="password"], input[type="email"], select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--ink);
  transition: border-color .15s;
}
.input:focus, input:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122,31,31,.08);
}
.input-row {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px;
}
.input-row label {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted);
}

/* ===== Badge ===== */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}
.badge-live    { background: #dcfce7; color: var(--good); }
.badge-soon    { background: #fef3c7; color: var(--warn); }
.badge-admin   { background: var(--accent); color: white; }

/* ===== Module grid (home) ===== */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.module-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  text-decoration: none; color: inherit;
  transition: all .2s ease;
  position: relative;
  min-height: 180px;
}
.module-card:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}
.module-card.soon { opacity: 0.65; cursor: not-allowed; }
.module-card.soon:hover { transform: none; }
.module-card .icon {
  font-size: 28px; line-height: 1;
  margin-bottom: 14px;
}
.module-card .title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 20px; font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  color: var(--ink);
}
.module-card .desc {
  font-size: 13.5px; color: var(--muted);
  line-height: 1.5;
  flex: 1;
}
.module-card .footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 18px;
}
.module-card .arrow {
  font-size: 14px; color: var(--accent);
  font-family: "JetBrains Mono", monospace;
}

/* ===== Table ===== */
.kdp-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
}
.kdp-table th, .kdp-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.kdp-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 500;
  background: var(--bg);
}
.kdp-table tbody tr:hover { background: rgba(122,31,31,0.03); }

/* ===== Login page ===== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.login-side {
  background: linear-gradient(160deg, #1a1a1a 0%, #2d1414 100%);
  color: #fafaf7;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 60px;
  position: relative; overflow: hidden;
}
.login-side::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(200,154,58,.12) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(122,31,31,.20) 0%, transparent 50%);
  pointer-events: none;
}
.login-side .brand-big {
  font-family: "Fraunces", Georgia, serif;
  font-size: 48px; font-weight: 600; letter-spacing: -0.03em;
  line-height: 1;
  position: relative;
}
.login-side .brand-big .accent { color: var(--accent-2); }
.login-side .tagline {
  font-family: "Fraunces", Georgia, serif;
  font-size: 30px; font-weight: 400;
  line-height: 1.2; max-width: 480px;
  color: rgba(255,255,255,.92);
  position: relative;
}
.login-side .tagline em { font-style: italic; color: var(--accent-2); }
.login-side .footer-note {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; letter-spacing: 0.05em;
  color: rgba(255,255,255,.45);
  position: relative;
}
.login-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 60px;
}
.login-form {
  width: 100%; max-width: 360px;
}
.login-form h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 28px; margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.login-form .sub {
  font-size: 13.5px; color: var(--muted); margin-bottom: 28px;
}
.login-form .login-err {
  background: #fee2e2; color: var(--bad);
  padding: 10px 14px; border-radius: var(--r);
  font-family: "JetBrains Mono", monospace; font-size: 12px;
  margin-bottom: 16px; display: none;
}
.login-form .login-err.show { display: block; }
.login-form .hint {
  margin-top: 18px;
  font-size: 12px; color: var(--muted);
  text-align: center;
  font-family: "JetBrains Mono", monospace;
}

@media (max-width: 880px) {
  .login-page { grid-template-columns: 1fr; }
  .login-side { display: none; }
}

/* ===== Coming-soon banner ===== */
.coming-soon {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 50vh;
  text-align: center;
  padding: 60px 24px;
}
.coming-soon .icon-big {
  font-size: 64px; margin-bottom: 24px;
}
.coming-soon h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 36px; letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.coming-soon p {
  color: var(--muted); max-width: 560px;
  font-size: 15px; line-height: 1.6;
}
.coming-soon .planned-features {
  margin-top: 32px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  max-width: 560px;
  width: 100%;
}
.coming-soon .planned-features h4 {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 12px;
}
.coming-soon .planned-features ul {
  margin: 0; padding-left: 18px;
  font-size: 14px; line-height: 1.7;
}

/* ===== Utility ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { gap: 12px; }
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
