/* Shared density and controls. Weather instrument dimensions live in weather.css. */
:root {
  --equipment-on:#087a35; --equipment-on-dot:#13b94f; --equipment-on-bg:#e8f7ee;
  --equipment-off:#b22d30; --equipment-off-dot:#e5484d; --equipment-off-bg:#fff0ef;
  --panel-padding:18px; --section-gap:14px; --field-gap:12px;
}
:root[data-theme=dark] {
  --equipment-on:#72f39a; --equipment-on-dot:#4ce77d; --equipment-on-bg:#153c2c;
  --equipment-off:#ff999b; --equipment-off-dot:#ff656c; --equipment-off-bg:#3d242c;
}
.topbar-inner { min-height:78px; padding:12px 32px; }
.brand-product .brand-version { display:inline-block; margin-left:9px; font-size:9px; letter-spacing:.7px; font-weight:500; vertical-align:middle; white-space:nowrap; }
body:not(.page-meteo) #main { padding-bottom:20px; }
.page-heading { padding:18px 0 12px; gap:16px; align-items:center; }
.page-heading h1 { font-size:27px; margin:0; letter-spacing:-.7px; }
#page-subtitle { margin-top:4px; font-size:12px; }
#page-subtitle:empty, #page-actions:empty { display:none; }
.admin-nav { padding-bottom:12px; gap:4px; }
.admin-nav a { padding:7px 12px; min-height:36px; }
.panel { padding:var(--panel-padding); border-radius:14px; }
.panel+.panel { margin-top:var(--section-gap); }
.panel h2 { font-size:20px; margin-bottom:12px; }
.panel h3 { margin-bottom:10px; }
.panel-header { margin-bottom:12px; gap:12px; }
.panel-header h2,.panel-header h3 { margin:0; }
.panel-description { margin-bottom:12px; }
.grid-two,.grid-three { gap:var(--section-gap); }
.grid-two { grid-template-columns:repeat(2,minmax(0,1fr)); }
.grid-three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--field-gap); }
.form-field { gap:5px; }
.form-field>label,.field-label { font-size:12px; }
input,select { min-height:40px; padding:8px 10px; }
textarea { padding:10px 12px; }
.form-actions { margin-top:12px; gap:8px; }
.form-help { margin-top:4px; }
label.checkbox { min-height:34px; gap:8px; }
.button { min-height:34px; padding:8px 12px; font-size:13px; }
.button.primary { min-height:38px; }
.small-button { min-height:32px; padding:6px 10px; font-size:12px; }
.button-group { gap:6px; align-items:center; }
.icon-action { min-width:32px; width:32px; min-height:32px; padding:0; }
.icon-action .icon { width:17px; height:17px; }
.section-toolbar { margin-bottom:12px; gap:12px; }
.divider { margin:16px 0; }
.note { line-height:1.55; margin-bottom:10px; }
.note:last-child { margin-bottom:0; }
.empty-state,.loading-state { padding:32px 16px; }
.empty-state h2 { margin-bottom:8px; }
.empty-state p { margin-bottom:12px; }
.pagination { gap:12px; margin:16px 0 0; }
dialog { width:min(760px,calc(100% - 32px)); max-height:calc(100dvh - 32px); padding:20px; border-radius:16px; }
.dialog-heading { margin-bottom:12px; gap:12px; }
.dialog-heading h2 { font-size:20px; }
dialog p { margin-bottom:12px; }
.settings-section { margin-bottom:20px; }
.settings-section h3 { padding-bottom:8px; margin-bottom:12px; }
.service-row { padding:10px 0; }
.audit-row { padding:10px 0; }
.audit-row pre { padding:10px; }
.audit-row summary { padding-top:4px; }
.audit-head { gap:10px; }

/* Dense rows on a pointer device; touch targets expand as a unit below. */
table { font-size:13px; }
th { padding:8px 10px; font-size:11px; }
td { padding:6px 10px; }
.users-table .user-name { font-weight:600; }
.users-table .user-id { color:var(--muted); }
.users-table td:last-child { width:84px; }
.users-table .button-group { flex-wrap:nowrap; }
.permission-table { min-width:650px; table-layout:fixed; }
.permission-table th:first-child { width:38%; }
.permission-table th { text-transform:none; letter-spacing:0; }
.permission-table td { padding:2px 10px; }
.permission-table td:first-child { min-width:0; }
.permission-table label { display:flex; align-items:center; justify-content:center; width:36px; min-height:36px; margin:auto; cursor:pointer; }
.permission-table input { margin:0; width:18px; height:18px; min-height:18px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* Shared confirmed-state indicators: optical APAPI colors are independent. */
.state { display:inline-flex; flex-shrink:0; align-items:center; justify-content:center; min-width:65px; min-height:30px; padding:4px 8px; border-radius:7px; background:var(--surface-3); color:var(--muted); font-size:14px; line-height:1.5; font-weight:750; letter-spacing:.2px; gap:7px; }
.state:before { content:''; width:9px; height:9px; border-radius:50%; flex-shrink:0; background:var(--muted); }
.state.on { color:var(--equipment-on); background:var(--equipment-on-bg); }
.state.on:before { background:var(--equipment-on-dot); }
.state.off { color:var(--equipment-off); background:var(--equipment-off-bg); }
.state.off:before { background:var(--equipment-off-dot); }
.state.unknown:before { background:transparent; border:2px solid var(--muted); }
.equipment-row { grid-template-columns:minmax(170px,1.1fr) minmax(180px,1fr) auto; padding:12px 0; gap:16px; }
.equipment-row:first-child { padding-top:0; }
.equipment-row:last-child { padding-bottom:0; }
.equipment-name { gap:12px; min-width:0; }
.equipment-name h3 { font-size:16px; margin:0 0 2px; }
.equipment-name>.icon { width:28px; height:28px; }
.equipment-name>.icon-apapi { width:32px; }
.equipment-controls { flex-wrap:nowrap; gap:5px; padding:0; }
.equipment-technical { display:flex; flex-wrap:wrap; gap:1px 8px; font-size:11px; line-height:1.4; margin-top:5px; }
.equipment-confirmed-label { font-size:11px; color:var(--muted); margin-right:6px; }
.equipment-controls .button { white-space:nowrap; }
.switch-target { min-width:60px; min-height:40px; }
.switch { margin:0; }
.switch[aria-checked=true] { background:#15803d; border-color:#15803d; }
.equipment-note { margin-top:12px; }

/* Calendars and bilingual dictionary entries retain all metadata. */
.calendar-week { gap:7px; margin-bottom:12px; }
.calendar-day { min-height:92px; padding:9px; }
.calendar-day>strong { font-size:21px; margin-bottom:7px; }
.calendar-event { padding:5px; font-size:11px; }
.schedule-card { padding:12px 0; gap:14px; align-items:center; }
.schedule-card h3 { margin:0; font-size:16px; }
.schedule-card small { font-size:12px; }
.schedule-card>.button-group { align-self:center; flex-wrap:wrap; justify-content:flex-end; }
.calendar-title,.calendar-meta,.calendar-dates { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 12px; }
.calendar-title { margin-bottom:4px; }
.calendar-meta { font-size:13px; color:var(--muted); }
.calendar-hours { color:var(--text); font-variant-numeric:tabular-nums; font-weight:650; }
.calendar-dates { margin-top:3px; }
.message-translations { margin-top:8px; }
.message-translations .note { margin:0; }

/* Lists of voices use short rows; expanded audio keeps its normal controls. */
.voice-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.voice-card { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-areas:'heading actions' 'meta actions' 'sample sample'; gap:3px 10px; padding:12px 14px; }
.voice-card>.panel-header { grid-area:heading; gap:5px; }
.voice-card h3 { font-size:14px; overflow-wrap:anywhere; }
.voice-meta { grid-area:meta; font-size:11px; line-height:1.5; overflow-wrap:anywhere; }
.voice-card>.button-group { grid-area:actions; margin:0; align-items:center; flex-direction:row; }
.voice-card .button { flex:0 0 auto; font-size:12px; padding:7px 9px; }
.voice-card [id^=sample-] { grid-area:sample; min-width:0; }
.voice-card [id^=sample-]:empty { display:none; }
.voice-card .audio-player { margin-top:8px; }
.voice-studio { margin-bottom:14px; }
.voice-studio .form-grid { grid-template-columns:1.2fr .8fr 1fr; }
#voice-text { min-height:100px; }
.audio-player { margin:10px 0 2px; }
.audio-links { margin-top:4px; gap:12px; }
.audio-links a { min-height:28px; }
.voice-studio small { overflow-wrap:anywhere; }

/* The writing area retains its useful height, while surrounding tools align. */
.editor-toolbar { display:grid; grid-template-columns:minmax(210px,1fr) minmax(210px,1fr) auto; align-items:end; gap:12px; margin-bottom:14px; }
.editor-toolbar>.button-group { justify-content:flex-end; padding-bottom:3px; }
.editor-language { margin-bottom:10px; }
.editor-text { min-height:300px; }
.variable-select { max-width:230px; }
.preview-text { margin-top:10px; line-height:1.6; }
.message-selection { gap:6px; }
.message-choice { min-height:36px; padding:6px 10px; }
.selected-messages { margin-top:8px; gap:6px; }
.move-button { min-width:32px; min-height:32px; }
.bulletin-heading { margin-bottom:16px; gap:16px; }
.atis-letter { font-size:44px; padding:16px 20px; }
.bulletin-heading h2 { margin-bottom:4px; }
.bulletin-text { line-height:1.7; margin-bottom:12px; }
.bulletin-card { margin-bottom:12px; }
.admin-grid { gap:12px; }
.admin-tile { padding:16px 18px; display:grid; grid-template-columns:28px minmax(0,1fr); column-gap:12px; row-gap:3px; align-items:center; }
.admin-tile>.icon { grid-row:1/3; margin:0; width:25px; height:25px; }
.admin-tile h3 { margin:0; font-size:16px; }
.admin-tile p { grid-column:2; }
.runway-choice { min-height:105px; }
.login-panel { padding:24px; margin:4px auto 20px; }
.login-panel .form-field { margin:14px 0; }
.login-emblem { margin-bottom:16px; }

@media(min-width:601px) { .nav-inner>a { padding:12px 2px; min-height:44px; } }
@media(min-width:1100px) {
  #settings-form .form-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  #audit-filter .form-grid { grid-template-columns:1.3fr 1fr 1fr .85fr .85fr; }
}
@media(min-width:1350px) { .voice-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:1100px) {
  .topbar-inner { padding-left:24px; padding-right:24px; }
  .equipment-row { grid-template-columns:minmax(170px,1fr) minmax(150px,.9fr); gap:10px 16px; }
  .equipment-controls { grid-column:1/-1; justify-content:flex-start; padding-left:40px; flex-wrap:wrap; }
  .editor-toolbar { grid-template-columns:1fr 1fr; }
  .editor-toolbar>.button-group { grid-column:1/-1; justify-content:flex-start; }
  .schedule-card { grid-template-columns:1fr; gap:8px; }
  .schedule-card>.button-group { justify-content:flex-start; }
  .voice-card { padding:12px; }
  .voice-card>.button-group { gap:4px; }
  .voice-card .button { padding:7px; }
  .voice-studio .form-grid { grid-template-columns:1fr 1fr; }
}
@media(max-width:820px) {
  .voice-grid { grid-template-columns:1fr; }
  .grid-three { grid-template-columns:1fr; }
  .admin-grid { grid-template-columns:1fr 1fr; }
}
@media(max-width:600px) {
  :root { --panel-padding:14px; --section-gap:12px; }
  .topbar-inner { min-height:72px; padding:12px 16px; }
  .brand-product .brand-version { display:block; font-size:7px; margin:3px 0 0; }
  .brand-product small { margin-top:3px; }
  body:not(.page-meteo) #main { padding-bottom:calc(76px + env(safe-area-inset-bottom)); }
  .page-heading { padding:16px 0 10px; gap:10px; }
  .page-heading h1 { font-size:24px; }
  #page-actions { width:auto; max-width:100%; }
  .admin-nav { padding-bottom:10px; }
  .admin-nav a { padding:7px 10px; }
  .panel h2 { font-size:19px; }
  .panel-header { flex-wrap:wrap; gap:8px; }
  .form-grid,.grid-two,.grid-three,.editor-toolbar { grid-template-columns:1fr; }
  .editor-toolbar>.button-group { grid-column:auto; flex-wrap:wrap; }
  .editor-text { min-height:270px; }
  .form-actions .button { flex:0 1 auto; }
  .section-toolbar { gap:10px; }
  .users-table,.users-table tbody { display:block; }
  .users-table thead { display:none; }
  .users-table tr { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:3px 10px; padding:12px 0; border-bottom:1px solid var(--line); }
  .users-table tr:last-child { border:0; padding-bottom:0; }
  .users-table td { border:0; padding:0; min-width:0; overflow-wrap:anywhere; }
  .users-table td:nth-child(1) { grid-column:1; grid-row:1; }
  .users-table td:nth-child(2) { grid-column:1; grid-row:2; font-size:12px; }
  .users-table td:nth-child(3) { grid-column:1; grid-row:3; font-size:12px; color:var(--muted); }
  .users-table td:nth-child(4) { grid-column:2; grid-row:1; text-align:right; }
  .users-table td:nth-child(5) { grid-column:2; grid-row:2/4; width:auto; align-self:center; }
  .permission-table { min-width:650px; }
  .table-wrap { margin:0; }
  .equipment-row { grid-template-columns:minmax(0,1fr) auto; gap:8px; }
  .equipment-name { gap:9px; }
  .equipment-name h3 { font-size:15px; }
  .equipment-name>.icon { width:25px; }
  .equipment-technical { flex-direction:column; gap:0; }
  .equipment-controls { padding:0; gap:5px; }
  .equipment-controls .small-button { padding:7px 9px; font-size:12px; }
  .calendar-day { min-width:102px; }
  .calendar-dates { gap:2px 10px; }
  .voice-studio .form-grid { grid-template-columns:1fr; }
  .voice-card { grid-template-columns:minmax(0,1fr) auto; }
  .voice-card .panel-header { flex-wrap:nowrap; }
  .voice-card .button { padding:7px; }
  .voice-card .button .icon { width:16px; }
  .voice-card>.button-group { flex-direction:row; }
  .admin-grid { grid-template-columns:1fr; }
  .admin-tile { padding:13px 14px; }
  .runway-choice { min-height:105px; }
  dialog { padding:16px; }
  .variable-select { max-width:none; }
}
@media(any-pointer:coarse), (max-width:1100px) {
  .button,.small-button,.button.primary,.icon-action,.icon-button,.move-button { min-height:44px; min-width:44px; }
  .icon-action { width:44px; }
  input:not([type=checkbox]):not([type=range]), select { min-height:44px; }
  label.checkbox,.message-choice,.permission-table label { min-height:44px; }
  .permission-table label { width:44px; }
  .switch { height:44px; min-height:44px; width:64px; padding:6px; }
  .switch-target { min-height:44px; min-width:64px; }
  .audio-links a,.admin-nav a { min-height:44px; }
  .form-field>label { line-height:1.45; }
}
