:root {
  --bg: #f4efe6;
  --bg-accent: #e9dcc9;
  --surface: #fffdf9;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #0f766e;
  --danger: #b91c1c;
  --success: #166534;
  --border: #d6d3d1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at top left, var(--bg-accent), var(--bg));
  color: var(--text);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

h1, h2, h3 {
  margin-top: 0;
}

label {
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.3rem;
}

input, select, button, textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.65rem;
  font-size: 1rem;
}

button {
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

button.secondary {
  background: #334155;
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 {
  grid-template-columns: 1fr;
}

.message {
  padding: 0.75rem;
  border-radius: 8px;
  margin-top: 0.7rem;
}

.message.error {
  background: #fee2e2;
  color: #991b1b;
}

.message.success {
  background: #dcfce7;
  color: var(--success);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.55rem;
  font-size: 0.9rem;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.8rem;
}

.small {
  font-size: 0.85rem;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tab-btn {
  width: auto;
  background: #334155;
  color: #fff;
  border-radius: 999px;
  padding: 0.5rem 1rem;
}

.tab-btn.active {
  background: var(--primary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
}

.modal.open {
  display: flex;
}

.modal-content {
  width: min(100%, 560px);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.modal-actions button {
  width: auto;
  min-width: 140px;
}

#reader {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}
