/* ============================================================
   Personal Vault — Dossier / Filing System aesthetic
   Palette: ink navy, aged paper, brass accent
   ============================================================ */

:root {
  --paper: #F6F3EC;
  --paper-line: #E4DFD1;
  --ink: #1F2A33;
  --ink-soft: #4A5A63;
  --navy: #1B3A4B;
  --navy-deep: #12262F;
  --brass: #A8823C;
  --brass-soft: #C9A96A;
  --danger: #A83232;
  --ok: #2F6B4F;
  --radius: 3px;
  --shadow: 0 1px 2px rgba(18, 38, 47, 0.08), 0 4px 14px rgba(18, 38, 47, 0.06);
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
}

body {
  background-image:
    linear-gradient(var(--paper-line) 1px, transparent 1px);
  background-size: 100% 32px;
  background-attachment: local;
}

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

/* ---------- Layout shells ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.brand-mark {
  width: 10px; height: 10px;
  background: var(--brass);
  border-radius: 1px;
  flex: none;
}

.brand h1 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin: 0;
}

.brand-sub {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 28px 20px;
}

/* Override for the signed-in user's email — shouldn't be uppercased/mono,
   since emails read poorly that way and can overflow the sidebar. */
#userEmail {
  text-transform: none;
  letter-spacing: normal;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  word-break: break-all;
  line-height: 1.4;
}
.sidebar #userEmail { color: #8FA2AC; }
.sidebar-topbar #userEmail { color: #8FA2AC; }

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

.sidebar {
  width: 232px;
  flex: none;
  background: var(--navy-deep);
  color: #E9E4D6;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
}

.sidebar .brand h1 { color: #fff; }
.sidebar .brand-sub { color: #8FA2AC; }

.nav-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  flex: 1;
}

.nav-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: #C9CFCE;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
  font-family: var(--mono);
  letter-spacing: 0.3px;
}

.nav-list a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-list a.active { background: var(--brass); color: var(--navy-deep); font-weight: 600; }

.nav-tag {
  font-size: 10px;
  color: #6E828C;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 18px 0 6px 12px;
}

.logout-btn {
  margin-top: auto;
  background: transparent;
  border: 1px solid #3A4E58;
  color: #C9CFCE;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
}
.logout-btn:hover { border-color: var(--danger); color: #E9A3A3; }

.main {
  flex: 1;
  padding: 40px 48px;
  max-width: 920px;
}

.page-head {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ink);
}

.page-head .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 6px;
}

.page-head h2 {
  font-family: var(--serif);
  font-size: 28px;
  margin: 0;
}

/* ---------- Forms ---------- */

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.5px;
  /* text-transform: uppercase; */
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #CFC9B8;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

.field textarea { resize: vertical; min-height: 70px; }

.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--brass-soft);
  outline-offset: 1px;
  border-color: var(--brass);
}

.field-row input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.copy-btn {
  flex: none;
  width: 40px;
  border: 1px solid #CFC9B8;
  border-left: none;
  background: var(--paper);
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.copy-btn:hover { background: var(--brass-soft); color: var(--navy-deep); }
.copy-btn.copied { background: var(--ok); color: #fff; border-color: var(--ok); }
.copy-btn svg { width: 16px; height: 16px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

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

.btn-secondary { background: transparent; border: 1px solid #CFC9B8; color: var(--ink); }
.btn-secondary:hover { border-color: var(--navy); }

.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-block { width: 100%; justify-content: center; }

/* ---------- Cards / lists ---------- */

.card {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.card-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  padding: 2px 8px;
  border-radius: 2px;
  color: var(--ink-soft);
}

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 12px;
  font-size: 14px;
}

.kv dt { color: var(--ink-soft); font-family: var(--mono); font-size: 12px; }
.kv dd { margin: 0; }

.row-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

.empty-state .mark {
  width: 36px; height: 36px;
  margin: 0 auto 14px;
  border: 2px solid var(--brass-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brass);
  font-family: var(--serif);
  font-size: 18px;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-error { background: #FBEAEA; border-color: #E7B8B8; color: var(--danger); }
.alert-ok { background: #EAF3EE; border-color: #B9D8C4; color: var(--ok); }

.hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: -10px;
  margin-bottom: 18px;
}

.divider-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--brass);
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--paper-line);
}

.avatar-preview {
  width: 88px; height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--paper-line);
  background: var(--paper);
}

.link-btn {
  background: none;
  border: none;
  color: var(--navy);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.toggle-row {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* Mobile nav elements — hidden on desktop by default */
.hamburger-btn { display: none; }
.sidebar-topbar { display: none; }
.nav-overlay { display: none; }

/* ============================================================
   Responsive — tablet (≤ 900px) and phone (≤ 480px)
   ============================================================ */

@media (max-width: 900px) {
  .main { padding: 32px 28px; }
  .sidebar { width: 200px; padding: 24px 16px; }
}

@media (max-width: 720px) {
  .app-shell { flex-direction: column; min-height: auto; }

  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: none;
    background: transparent;
    border: 1px solid #3A4E58;
    border-radius: var(--radius);
    color: #E9E4D6;
    cursor: pointer;
  }
  .hamburger-btn svg { width: 20px; height: 20px; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 250px;
    flex-direction: column;
    align-items: stretch;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
  .sidebar.nav-open { transform: translateX(0); }

  .sidebar .brand { margin-bottom: 4px; }
  .sidebar .brand-sub { display: block; }

  .sidebar-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--navy-deep);
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .sidebar-topbar .brand { margin-bottom: 0; }
  .sidebar-topbar .brand h1 { font-size: 17px; color: #fff; }

  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(18,38,47,0.45);
    z-index: 90;
  }
  .nav-overlay.nav-open { display: block; }

  .nav-list { display: block; flex: 1; }
  .nav-list a { margin-bottom: 2px; }
  .nav-tag { display: block; }

  .logout-btn { margin-top: auto; }

  .main { padding: 20px 16px 40px; max-width: 100%; }

  .page-head h2 { font-size: 22px; }
  .page-head { margin-bottom: 20px; padding-bottom: 12px; }

  .grid-2 { grid-template-columns: 1fr; gap: 0; }

  .kv { grid-template-columns: 100px 1fr; font-size: 13px; }
  .kv dt { font-size: 11px; }

  .card { padding: 18px 16px; }

  .auth-card { padding: 30px 22px; }

  .row-actions { flex-wrap: wrap; }
  .row-actions .btn { flex: 1 1 auto; text-align: center; }

  .btn { width: 100%; justify-content: center; }
  .row-actions .btn { width: auto; }
}

@media (max-width: 480px) {
  body { background-size: 100% 28px; }

  .auth-shell { padding: 16px; }
  .auth-card { padding: 24px 18px; }
  .brand h1 { font-size: 19px; }

  .sidebar .brand h1 { font-size: 15px; }
  .nav-list a { font-size: 12px; padding: 7px 9px; }

  .main { padding: 16px 12px 32px; }
  .page-head h2 { font-size: 19px; }
  .page-head .eyebrow { font-size: 10px; }

  .field input, .field select, .field textarea {
    font-size: 16px; /* prevents iOS auto-zoom on focus */
    padding: 10px 11px;
  }

  .copy-btn { width: 42px; } /* keep touch target comfortable */

  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .kv dt:first-child { margin-top: 0; }

  .avatar-preview { width: 64px; height: 64px; }

  .card-head { flex-direction: column; gap: 8px; }
  .card-head .tag { align-self: flex-start; }
}

