/* ============================================================================
 * app.css — shared component classes.  Page-specific styles live inline in
 * each PHP file's <style> block, scoped via a class on the page wrapper.
 *
 * Tokens come from tokens.css — do not redefine them here.
 * ========================================================================== */

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

html, body {
  background: var(--surface-0);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--deep-grass); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- page shell */

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

/* Earth-brown left rail.  Compact on phones via media query. */
.rail {
  width: 64px;
  background: var(--earth);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 4px;
  flex-shrink: 0;
}
.rail-logo {
  font-family: var(--font-display);
  color: var(--straw);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}
.rail-item {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  gap: 2px;
  transition: background 0.15s;
  border: 1px solid transparent;
  text-decoration: none;
}
.rail-item:hover { background: rgba(201,169,110,0.12); text-decoration: none; }
.rail-item.active {
  background: rgba(201,169,110,0.18);
  border-color: rgba(201,169,110,0.25);
}
.rail-icon { font-size: 16px; color: var(--straw); line-height: 1; }
.rail-label {
  font-size: 9px;
  color: var(--ink-4);
  letter-spacing: 0.3px;
  text-align: center;
}
.rail-item.active .rail-label { color: var(--straw); }
.rail-spacer { flex: 1; }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  background: var(--surface-1);
  flex-shrink: 0;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
}
.topbar-sub { font-size: 12px; color: var(--ink-4); }
.topbar-spacer { flex: 1; }
.topbar-badge {
  background: var(--moss);
  color: var(--parchment);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 500;
}
.topbar-badge.warn { background: var(--amber); color: var(--ink); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ------------------------------------------------------------- primitives */

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary {
  background: var(--moss);
  color: var(--parchment);
  box-shadow: 0 2px 6px rgba(46,92,52,0.3);
}
.btn-primary:hover { background: var(--deep-grass); text-decoration: none; }
.btn-secondary {
  background: var(--surface-0);
  color: var(--bark);
  border-color: var(--border-mid);
}
.btn-secondary:hover { background: var(--surface-2); text-decoration: none; }
.btn-danger {
  background: var(--rust);
  color: var(--parchment);
}
.btn-danger:hover { background: #A04D22; text-decoration: none; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="file"],
.field select,
.field textarea {
  width: 100%;
  background: var(--surface-0);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--moss);
}
.field-help {
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 4px;
}

.card {
  background: var(--surface-1);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}

.empty {
  background: var(--surface-1);
  border: 1.5px dashed var(--border-mid);
  border-radius: var(--r-lg);
  padding: 28px 22px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}
.empty h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.flash {
  padding: 10px 14px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  font-size: 13px;
}
.flash.success { background: rgba(74,122,80,0.12); color: var(--deep-grass); border: 1px solid var(--moss); }
.flash.error   { background: rgba(196,98,45,0.10); color: var(--rust); border: 1px solid var(--rust); }
.flash.info    { background: rgba(212,147,42,0.10); color: var(--bark); border: 1px solid var(--amber); }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-1);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1.5px solid var(--border-mid);
}
table.data th {
  background: var(--earth);
  color: var(--straw);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
}
table.data td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink-2);
}
table.data tr:last-child td { border-bottom: none; }
table.data td.mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }

.muted { color: var(--ink-4); }
.mono  { font-family: var(--font-mono); }
.row { display: flex; align-items: center; gap: 10px; }

/* ------------------------------------------------------------- mobile rail */
@media (max-width: 640px) {
  .app { flex-direction: column; }
  .rail {
    width: 100%;
    height: 56px;
    flex-direction: row;
    justify-content: space-between;
    padding: 0 14px;
    gap: 2px;
  }
  .rail-logo { display: none; }
  .rail-spacer { display: none; }
  .rail-item { width: 56px; height: 44px; }
  .topbar { padding: 0 14px; }
  .content { padding: 14px; }
}
