/* Kabyle Speech Corpus — web interface */
:root {
  --accent: #00796b; --accent-dark: #00564d; --danger: #c62828; --success: #2e7d32;
  --bg: #f5f7f7; --card: #ffffff; --text: #1d2626; --muted: #5f6b6b; --line: #dde3e3;
  --warn-bg: #fff4e5; --notice-bg: #fff8d6; --error-bg: #fdecea; --ok-bg: #e8f5e9;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Tifinagh", sans-serif;
       background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .4rem 0 .6rem; }
h2 { font-size: 1.2rem; margin: .2rem 0 .6rem; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
          padding: .7rem 1.2rem; background: var(--accent); color: #fff; }
.topbar a, .topbar .link { color: #fff; text-decoration: none; margin-left: 1rem; font-weight: 500; }
.topbar .brand { margin-left: 0; font-weight: 700; font-size: 1.1rem; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }

.page { max-width: 960px; margin: 0 auto; padding: 1rem 1.2rem 3rem; }
.page.narrow { max-width: 520px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; margin: .8rem 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.tile { text-decoration: none; color: inherit; transition: box-shadow .15s; }
.tile:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }

.row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.row > label { flex: 1 1 200px; }
.between { justify-content: space-between; align-items: center; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

.form label { display: block; margin: .5rem 0; font-weight: 500; }
.form label small { color: var(--muted); font-weight: 400; }
.form input:not([type=checkbox]):not([type=radio]), .form select, select {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .6rem; font-size: 1rem;
  border: 1px solid #c6cfcf; border-radius: 8px; background: #fff; }
.inline-label select { display: inline-block; width: auto; margin-left: .4rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .4rem .8rem .6rem; margin: .5rem 0; }
legend { font-weight: 600; padding: 0 .3rem; }
.form label.check, label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; margin: .35rem 0; }
.consent { background: var(--warn-bg); border-radius: 8px; padding: .6rem; }

button, .button { display: inline-block; padding: .55rem 1rem; font-size: 1rem; border-radius: 8px; cursor: pointer;
  border: 1px solid #c6cfcf; background: #fff; color: var(--text); text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
button.primary, .button { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.success { background: var(--success); border-color: var(--success); color: #fff; }
button.small { padding: .3rem .7rem; font-size: .9rem; }
button.link { background: none; border: none; color: var(--accent); padding: .3rem; }
.topbar button.link { color: #fff; }

.alert { background: var(--error-bg); border-left: 4px solid var(--danger); padding: .6rem .8rem; border-radius: 6px; }
.ok-msg { background: var(--ok-bg); border-left: 4px solid var(--success); padding: .6rem .8rem; border-radius: 6px; }
.warning { background: var(--warn-bg); padding: .5rem .8rem; border-radius: 8px; margin: .4rem 0; }
.notice { background: var(--notice-bg); padding: .5rem .8rem; border-radius: 8px; margin: .6rem 0; text-align: center; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 500; font-size: .9rem; }

/* recording + validation */
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: .4rem 0; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.prompt-card { text-align: center; padding: 2rem 1rem; }
.prompt-text { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 700; text-align: center; margin: .3rem 0; }
.prompt-tifinagh { font-size: 1.6rem; text-align: center; color: #333; }
.meanings { text-align: center; color: var(--muted); font-size: 1.15rem; margin-top: .6rem; }
.meter { height: 12px; background: var(--line); border-radius: 6px; overflow: hidden; margin: .6rem 0; }
#meter-bar { height: 100%; width: 0; background: #f57c00; transition: width .05s; }
#meter-bar.good { background: var(--success); } #meter-bar.loud { background: var(--danger); }
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin: 1rem 0; }
.controls button { min-width: 120px; padding: .8rem 1.2rem; font-size: 1.1rem; }
button.record { background: var(--danger); border-color: var(--danger); color: #fff; min-width: 180px; }
button.record.recording { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { white-space: nowrap; background: #e6f2f0; color: var(--accent-dark); border-radius: 999px; padding: .2rem .7rem; font-size: .9rem; }
.player { display: block; width: 100%; margin: 1rem 0 .4rem; }
.reasons { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .2rem .8rem; }

/* a speaker's recordings */
.table-wrap { overflow-x: auto; }
td.actions { white-space: nowrap; }
td.actions button + button { margin-left: .4rem; }
button.play { min-width: 2.4rem; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .85rem; white-space: nowrap; }
.badge.pending { background: #fff4e5; color: #8a4b00; }
.badge.approved { background: #e8f5e9; color: #1b5e20; }
.badge.rejected { background: #fdecea; color: #b71c1c; }

/* statistics page — bars: one hue (#00897b, passes the chart colour checks), thin, 4px rounded tip */
.page.wide { max-width: 1180px; }
h2.section { margin-top: 1.6rem; border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
h3 { font-size: 1rem; margin: .2rem 0 .6rem; }
.filters { display: flex; flex-wrap: wrap; gap: 1rem; margin: .4rem 0 1rem; }
.button.small-btn { padding: .35rem .8rem; font-size: .9rem; }
.button.secondary { background: #fff; color: var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; }
.kpi-label { color: var(--muted); font-size: .85rem; }
.kpi-value { font-size: 1.8rem; font-weight: 600; line-height: 1.2; }
.kpi-sub { color: var(--muted); font-size: .8rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 0 1rem; }
.grid2 > .card { min-width: 0; overflow-x: auto; }
.grid2 .span2 { grid-column: 1 / -1; }
table.bars { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.bars th { text-align: left; color: var(--muted); font-weight: 500; font-size: .8rem; padding: .25rem .4rem; border-bottom: 1px solid var(--line); }
table.bars td { padding: .28rem .4rem; border-bottom: 1px solid #eef1f1; }
table.bars tr:hover td { background: #f3f8f7; }
table.bars .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.bars .label { max-width: 260px; }
.barcell { width: 38%; white-space: nowrap; }
.barcell .bar { display: inline-block; vertical-align: middle; width: calc(100% - 3.6rem); height: 12px; }
.barcell .bar span { display: block; height: 100%; min-width: 2px; background: #00897b; border-radius: 0 4px 4px 0; }
.barcell .pct { display: inline-block; width: 3.4rem; text-align: right; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.columns { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: .4rem; border-bottom: 1px solid var(--line); }
.columns .col { flex: 1 1 0; max-width: 24px; height: 100%; display: flex; align-items: flex-end; }
.columns .col span { display: block; width: 100%; min-height: 2px; background: #00897b; border-radius: 4px 4px 0 0; }
.columns .col:hover span { background: #00564d; }

@media (max-width: 600px) {          /* phones: tighter tables, percentage under the bar */
  table.bars { font-size: .82rem; }
  .page.wide { padding-left: .6rem; padding-right: .6rem; }
  .grid2 > .card { padding: .75rem .6rem; }
  table.bars .label { min-width: 5.8rem; max-width: 9rem; overflow-wrap: break-word; hyphens: auto; }
  table.bars th { font-size: .72rem; }
  table.bars th.barcell { white-space: normal; }
  table.bars th, table.bars td { padding: .25rem .15rem; }
  .barcell { width: 22%; }
  .barcell .bar { width: 100%; }
  .barcell .pct { display: block; width: auto; text-align: left; font-size: .7rem; line-height: 1.1; }
}
