:root {
  --bg: #0d0d0f;
  --surface: #16161a;
  --surface-2: #1d1d22;
  --border: #26262b;
  --text: #f5f4ef;
  --text-muted: #8a878d;
  --accent: #e07856;
  --accent-soft: #e0785622;
  --success: #6ec77f;
  --danger: #d96666;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  background: var(--accent);
  color: #1a0a04;
  font-weight: 600;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
button:hover { opacity: 0.92; }
button:active { transform: translateY(1px); }
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field { margin-bottom: 14px; }

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.topbar h1 {
  font-size: 22px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar .user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 8px;
}
@media (min-width: 520px) {
  .tiles { grid-template-columns: 1fr 1fr; }
}

.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, border-color 0.15s ease;
}
.tile:hover { transform: translateY(-2px); border-color: #34343a; text-decoration: none; }
.tile .icon {
  font-size: 26px;
  margin-bottom: 12px;
  display: inline-flex;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  align-items: center; justify-content: center;
}
.tile h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.tile p  { margin: 0; color: var(--text-muted); font-size: 14px; }

.tile.coming { opacity: 0.5; pointer-events: none; }
.tile.coming::after {
  content: "soon";
  float: right;
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Auth card */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 22px;
  box-shadow: var(--shadow);
}
.auth-card h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.auth-card .sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 22px;
}
.auth-card button[type="submit"] { width: 100%; }
.auth-card .switch {
  margin-top: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.notice {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.notice.error { background: #3a1a1a; color: #f6b8b8; border: 1px solid #5a2a2a; }
.notice.success { background: #1a2e1f; color: #b6e3b8; border: 1px solid #2a4530; }

/* Helpers */
.muted { color: var(--text-muted); }
.row { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }

/* Module pages */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 8px 0 14px;
}
.section-title h2 { margin: 0; font-size: 18px; font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card h4 { margin: 0 0 4px; font-size: 15px; }
.card .meta { color: var(--text-muted); font-size: 13px; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; }
.card-actions button { padding: 8px 12px; font-size: 13px; }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty h3 { margin: 0 0 6px; color: var(--text); font-weight: 600; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}
.back-link:hover { color: var(--text); text-decoration: none; }

dialog {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 420px;
  width: 92vw;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,0.5); }
dialog h3 { margin: 0 0 14px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
