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

:root {
  --bg: #f3f1e8;
  --surface: #fffdf7;
  --surface-soft: #faf8ef;
  --border: #dedbd0;
  --text: #1f2933;
  --muted: #69716d;
  --nav: #243447;
  --primary: #256d9c;
  --primary-dark: #1f5c84;
  --success: #1f8f60;
  --danger: #b63d2d;
  --shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
}

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--nav);
  color: #fff;
  padding: 0.8rem clamp(1rem, 4vw, 2rem);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08);
}

.app-brand {
  font-size: 1.05rem;
  font-weight: 800;
  white-space: nowrap;
  margin-right: 0.75rem;
}

.app-links {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-links::-webkit-scrollbar { display: none; }

.app-nav a {
  color: rgba(255,255,255,0.86);
  text-decoration: none;
  padding: 0.5rem 0.78rem;
  border-radius: 6px;
  white-space: nowrap;
}

.app-nav a:hover,
.app-nav a.active {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

.page {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 2.2rem clamp(1rem, 4vw, 2.5rem) 4rem;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}

.page-title {
  color: #243447;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
  margin-bottom: 0.55rem;
}

.page-subtitle {
  color: var(--muted);
  max-width: 46rem;
  line-height: 1.6;
}

.panel {
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.list-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.list-meta {
  color: var(--muted);
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #ece8dc;
  background: var(--surface-soft);
}

.btn {
  padding: 0.72rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.98rem;
  font-weight: 650;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #18784f; }
.btn-danger { background: #fff7f4; color: var(--danger); border-color: #efc6bc; }
.btn-danger:hover { background: #fbe9e4; }
.btn-secondary { background: #eef1ef; color: #35424a; border-color: #d7ddd9; }
.btn-secondary:hover { background: #e4e9e6; }

.form-group { margin-bottom: 1rem; }
label { display: block; margin-bottom: 0.45rem; font-weight: 650; color: #4d554f; font-size: 0.88rem; }
input, textarea, select {
  width: 100%;
  padding: 0.72rem 0.78rem;
  border: 1px solid #d9d6c8;
  border-radius: 6px;
  font-size: 0.98rem;
  background: #fffdf7;
  color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(37,109,156,0.18); border-color: #7aa7c7; }
textarea { font-family: inherit; }

.badge {
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  font-size: 0.82rem;
  background: #edf0ed;
  color: #4f5b54;
  display: inline-block;
}

.badge-new { background: #e8f2fb; color: #256d9c; }
.badge-synced { background: #e6f4ee; color: #1f8f60; }
.badge-mastered { background: #fff2d8; color: #9a6700; }

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 36, 0.48);
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: var(--surface);
  max-width: 900px;
  margin: 5vh auto;
  padding: 1.5rem;
  border-radius: 8px;
  max-height: 86vh;
  overflow-y: auto;
}

.close {
  float: right;
  font-size: 1.8rem;
  cursor: pointer;
  color: #87908a;
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.9rem 1rem; text-align: left; border-bottom: 1px solid #ece8dc; }
th { background: var(--surface-soft); font-weight: 700; color: #4d554f; }
tr:hover { background: #f8f6ee; }

@media (max-width: 760px) {
  .app-nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
  }

  .app-brand { font-size: 1.1rem; }
  .app-links { width: 100%; padding-bottom: 0.1rem; }
  .app-nav a { padding: 0.48rem 0.72rem; background: rgba(255,255,255,0.08); }
  .page { padding: 1.5rem 1rem 5rem; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-title { font-size: 2rem; }
  .btn { width: 100%; }
  .modal-content { margin: 2vh auto; }
}
