/* UI layer: visual design only. Keep this file easy to swap when the design changes. */
:root {
  --ink: #152026;
  --ink-soft: #2a3a3e;
  --paper: #f6f3ee;
  --line: rgba(28, 43, 46, 0.12);
  --muted: #5c6b6e;
  --accent: #1f7a76;
  --accent-soft: #e6f3f2;
  --white: #ffffff;
  --danger: #9b3a32;
  --sidebar: 260px;
  --tabbar: 64px;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(21, 32, 38, 0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

html, body {
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, a, input { font: inherit; color: inherit; }

.app {
  min-height: 100%;
  display: flex;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.sidebar {
  display: none;
  width: var(--sidebar);
  flex-shrink: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 28px 18px 24px;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 28px;
}

.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-text strong {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 560;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.brand-text span { font-size: 0.75rem; color: rgba(246, 243, 238, 0.62); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: rgba(246, 243, 238, 0.78);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
}
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--paper); }
.nav-item.is-active { background: var(--accent); color: var(--white); }
.nav-item.is-active svg { opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  padding: 16px 10px 0;
  font-size: 0.75rem;
  color: rgba(246, 243, 238, 0.5);
}

.sidebar-foot button {
  background: none;
  border: 0;
  color: rgba(246, 243, 238, 0.78);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: 0.75rem;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar) + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: calc(12px + var(--safe-top)) 20px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 560;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.updated { font-size: 0.8rem; color: var(--muted); }

.content {
  flex: 1;
  padding: 20px 20px 32px;
  max-width: 860px;
  width: 100%;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

.placeholder { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.placeholder p { color: var(--ink-soft); max-width: 36em; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--paper);
}
.item h3 { font-size: 0.95rem; margin-bottom: 4px; }
.item p { font-size: 0.9rem; color: var(--muted); }

.error {
  color: var(--danger);
  background: #f8eeee;
  border: 1px solid #ead4d2;
  border-radius: 12px;
  padding: 14px 16px;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: space-around;
  gap: 2px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--safe-bottom));
  padding-left: max(4px, var(--safe-left));
  padding-right: max(4px, var(--safe-right));
}

.tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 6px 2px 4px;
  text-decoration: none;
  cursor: pointer;
  border-radius: 10px;
}
.tab svg { width: 22px; height: 22px; }
.tab span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.tab.is-active { color: var(--accent); }

/* Login */
.login-body { background: var(--ink); }
.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--paper);
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
}
.login-card .brand { padding: 0 0 20px; color: var(--ink); }
.login-card .brand-text span { color: var(--muted); }
.login-card h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.45rem;
  font-weight: 560;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.login-card .lead { color: var(--muted); font-size: 0.9rem; margin-bottom: 22px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 12px;
  padding: 14px 14px;
  font-size: 1rem;
}
.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 6px 0 18px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }

.btn {
  width: 100%;
  border: 0;
  background: var(--accent);
  color: var(--white);
  font-weight: 600;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
}
.btn:disabled { opacity: 0.65; cursor: default; }
.btn-link {
  display: block;
  width: 100%;
  margin-top: 14px;
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
}

.form-error {
  display: none;
  color: var(--danger);
  background: #f8eeee;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
  margin-bottom: 14px;
}
.form-error.is-visible { display: block; }

@media (min-width: 860px) {
  .sidebar { display: flex; }
  .tabbar { display: none; }
  .main { padding-bottom: 0; }
  .topbar { padding: 22px 32px 16px; }
  .topbar h1 { font-size: 1.6rem; }
  .content { padding: 28px 32px 48px; }
}

.pin-input {
  -webkit-text-security: disc;
  text-security: disc;
}
