/* sip_core/service/static/window.css -- palette, spacing and table style
   taken from docs/mockups/2026-09-17-window/home.html and
   site-workspace.html. System fonts only: the CSP (style-src 'self')
   forbids fetching one, and this whole window ships with no fonts of its
   own. Readable at 1024px, usable down to 600px (this task's brief). */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;

  --text: #222;
  --text-muted: #666;
  --text-faint: #999;

  --border: #ccc;
  --border-light: #ddd;
  --border-faint: #eee;

  --bg: #fff;
  --bg-panel: #f7f7f7;
  --bg-header: #f0f0f0;

  --blue: #2f6feb;
  --blue-dark: #1d54c4;

  --ok-bg: #eee;
  --ok-border: #bbb;
  --ok-text: #444;

  --warn-bg: #fdf3d6;
  --warn-border: #e0c374;
  --warn-text: #8a6d1a;

  --danger-bg: #c0392b;
  --danger-border: #a5281a;
  --danger-row-bg: #fbe9e9;
  --danger-text: #b3261e;

  --paused-text: #888;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.4;
}

a {
  color: var(--blue);
}

h1, h2, h3 {
  margin: 0 0 10px;
  font-weight: 600;
}

p {
  margin: 0 0 10px;
}

/* -- top bar --------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.topbar .brand {
  font-weight: 700;
}

.topbar .who {
  color: var(--text-muted);
}

.topnav {
  display: flex;
  gap: 12px;
  margin-left: auto;
}

.topnav a {
  text-decoration: none;
  font-size: 13px;
}

.topnav a:hover {
  text-decoration: underline;
}

#app {
  padding: 16px;
  max-width: 960px;
  margin: 0 auto;
}

/* -- buttons ----------------------------------------------------------- */

.btn {
  font-family: inherit;
  font-size: 13px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  border-color: var(--text-muted);
}

.btn:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
  background: var(--bg-panel);
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.btn-danger {
  color: var(--danger-bg);
  border-color: var(--danger-border);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-row-bg);
}

/* -- forms --------------------------------------------------------------- */

form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.add-person-form {
  flex-direction: row;
  align-items: flex-end;
  flex-wrap: wrap;
  max-width: none;
  margin-bottom: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

input, select {
  font-family: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
}

input.remove-confirm {
  width: 160px;
}

/* -- messages ------------------------------------------------------------ */

.message {
  font-size: 13px;
  min-height: 1.4em;
}

.message-error {
  color: var(--danger-text);
}

.message-ok {
  color: #1a7a3a;
}

/* -- chips ---------------------------------------------------------------- */

.chip {
  display: inline-block;
  border-radius: 10px;
  padding: 2px 9px;
  font-size: 11px;
  border: 1px solid var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-text);
}

.chip-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text);
  font-weight: 700;
}

.chip-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: #fff;
  font-weight: 700;
}

.chip-running {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 600;
}

.chip-paused {
  background: #fff;
  border-color: var(--ok-border);
  color: var(--paused-text);
}

/* -- tables (docs/mockups/2026-09-17-window/home.html's own table) ------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid #999;
}

td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
}

tr.needs-attention {
  background: var(--danger-row-bg);
}

tr.held {
  background: var(--warn-bg);
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* -- sign-in --------------------------------------------------------------- */

.signin-form {
  max-width: 320px;
  margin: 48px auto 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.https-notice {
  max-width: 320px;
  margin: 24px auto 0;
  padding: 8px 12px;
  background: var(--bg-header);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* -- accounts --------------------------------------------------------------- */

.one-time-password {
  margin-bottom: 12px;
}

.one-time-password-value {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  padding: 6px 10px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 4px;
  display: inline-block;
}

.one-time-password-warning {
  color: var(--danger-text);
  font-size: 12px;
}

/* -- home (docs/mockups/2026-09-17-window/home.html) --------------------- */

.instance-line {
  padding: 8px 12px;
  background: var(--bg-header);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 12px;
}

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filter-btn-active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.recent-runs-heading {
  margin-top: 18px;
  font-size: 14px;
}

.recent-runs-list {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.9;
}

.recent-run-row a {
  color: inherit;
}

/* -- site workspace (docs/mockups/2026-09-17-window/site-workspace.html) - */

.site-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.site-title {
  font-size: 16px;
}

.site-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.site-updated-at {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 11px;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.clear-group, .discard-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.why-input {
  width: 220px;
}

.site-columns {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.site-column-main {
  flex: 0 0 61%;
  min-width: 0;
}

.site-column-side {
  flex: 1;
  min-width: 0;
}

.section {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--bg);
  max-width: none;
}

.section form, .section > label {
  max-width: none;
}

.run-window-row {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.switches-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 4px;
}

.switch-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  font-family: inherit;
  font-size: 13px;
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.switch:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.switch-pill {
  display: inline-block;
  min-width: 30px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e2e2e2;
  color: #666;
}

.switch-on .switch-pill {
  background: var(--blue);
  color: #fff;
}

.switch-note {
  font-size: 11px;
  color: var(--text-faint);
  margin-left: 40px;
}

.chunk-note {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 10px;
}

.day-note {
  font-size: 12px;
  color: var(--danger-text);
  margin: -6px 0 12px;
}

.day-note:empty {
  display: none;
}

.run-sentence {
  font-size: 13px;
  margin-bottom: 12px;
}

.run-sentence:empty {
  display: none;
}

.staged-panel[hidden] {
  display: none;
}

.staged-run-name {
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: 2px;
}

.staged-run-age {
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.staged-totals-table {
  margin-bottom: 10px;
}

.staged-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.config-chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.config-chip {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  cursor: pointer;
  font-family: inherit;
}

.config-chip-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 600;
}

.schedule-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.paused-line {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 10px;
}

.last-queried-current {
  font-family: var(--mono);
}

.history-list {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  max-height: 260px;
  overflow-y: auto;
}

.history-row {
  padding: 7px 4px;
  border-bottom: 1px solid var(--border-faint);
  display: flex;
  gap: 8px;
}

.history-row-link {
  cursor: pointer;
}

.history-row-link:hover {
  background: var(--bg-panel);
}

.history-at {
  color: var(--text-faint);
  font-family: var(--mono);
  white-space: nowrap;
}

.log-heading {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.log-lines {
  font-size: 11px;
  font-family: var(--mono);
  line-height: 1.7;
  max-height: 320px;
  overflow-y: auto;
}

.log-line {
  padding: 2px 4px;
}

.log-type {
  border-radius: 3px;
  padding: 0 4px;
}

.log-type-stats {
  background: #eef2fe;
  color: var(--blue);
}

.log-type-trace {
  color: var(--text-faint);
}

.log-type-warning {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.log-type-error {
  background: var(--danger-bg);
  color: #fff;
}

/* -- narrow screens (this task's brief: "usable down to 600px") --------- */

@media (max-width: 600px) {
  #app {
    padding: 10px;
  }

  .topbar {
    padding: 8px;
  }

  .add-person-form {
    flex-direction: column;
    align-items: stretch;
  }

  .site-columns {
    flex-direction: column;
  }

  .site-column-main, .site-column-side {
    flex: 1 1 auto;
    width: 100%;
  }

  .run-window-row {
    flex-direction: column;
    gap: 10px;
  }

  table, thead, tbody, tr, th, td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    border-bottom: 2px solid var(--border);
    padding: 6px 0;
  }

  td {
    border-bottom: none;
    padding: 3px 4px;
  }
}

/* -- receipt (Plan 5) ---------------------------------------------------- */
.receipt-closing { font-weight: 600; margin-bottom: 8px; }
.receipt-incomplete {
  margin-bottom: 8px; padding: 6px 8px;
  border-left: 3px solid var(--warn-border);
  background: var(--warn-bg); color: var(--warn-text);
}
.receipt-line { margin: 2px 0; }
.receipt-label { display: inline-block; min-width: 110px; color: var(--text-muted); }
.receipt-table { border-collapse: collapse; margin: 8px 0; }
.receipt-table th, .receipt-table td { padding: 2px 10px 2px 0; text-align: left; }
.receipt-note { font-size: 0.9em; color: var(--text-muted); }
.receipt-timeline { margin-top: 8px; max-height: 240px; overflow-y: auto; }
