/* thawt.net theme (docs/ARCHITECTURE.md SS9): grayscale only, no hue
   anywhere, including the focus ring - "accent-free" per that
   requirement. Visual direction is a stark, high-contrast "elite
   intelligence platform" look: heavy tight-tracked display type, hairline
   rules instead of filled cards, sharp corners throughout, small
   wide-tracked uppercase labels for structure. Light is the default; dark
   follows the OS via prefers-color-scheme - both are full-contrast, not
   just an inverted afterthought. */

:root {
  --gray-0: #ffffff;
  --gray-50: #f6f6f6;
  --gray-100: #e8e8e8;
  --gray-200: #d4d4d4;
  --gray-300: #b8b8b8;
  --gray-400: #969696;
  --gray-500: #757575;
  --gray-600: #595959;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #121212;
  --black: #000000;

  --color-bg: var(--gray-0);
  --color-border: var(--gray-200);
  --color-border-strong: var(--black);
  --color-text: var(--black);
  --color-text-muted: var(--gray-600);
  --color-control-bg: var(--gray-0);
  --color-control-border: var(--gray-300);
  --color-button-bg: var(--black);
  --color-button-text: var(--gray-0);
  --color-focus: var(--black);
  --grid-line: rgba(0, 0, 0, 0.035);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Consolas", "Roboto Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: var(--black);
    --color-border: var(--gray-800);
    --color-border-strong: var(--gray-0);
    --color-text: var(--gray-0);
    --color-text-muted: var(--gray-400);
    --color-control-bg: var(--gray-900);
    --color-control-border: var(--gray-700);
    --color-button-bg: var(--gray-0);
    --color-button-text: var(--black);
    --color-focus: var(--gray-0);
    --grid-line: rgba(255, 255, 255, 0.06);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--color-bg);
  background-image:
    repeating-linear-gradient(to right, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 48px),
    repeating-linear-gradient(to bottom, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 48px);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.5;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

a {
  color: var(--color-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--color-text-muted);
}

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: clamp(1.5rem, 2.5vw + 1rem, 2.25rem);
}

h2 {
  font-size: clamp(1.25rem, 1.5vw + 1rem, 1.75rem);
  margin-top: 2.5rem;
}

h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

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

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

.site-header {
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2.5rem;
}

.site-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header .brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.site-header .status {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.site-header .identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-header .nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-header .nav-links > *:not(:first-child) {
  border-left: 1px solid var(--color-border);
  padding-left: 1rem;
}

.site-header .nav-links .inline-form {
  display: inline-flex;
  align-items: center;
}

.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 3rem;
}

.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.site-footer p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Makes a <button> read as a plain nav link (e.g. "Log out" next to
   "Settings"), since logout has to be a POST form, not an <a>. */
.link-button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--color-text);
  font: inherit;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  background: none;
  border: none;
  color: var(--color-text-muted);
}

.card {
  border: 1px solid var(--color-border);
  border-radius: 0;
  padding: 1.5rem;
  background: transparent;
  margin-bottom: 1.25rem;
}

legend {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0 0.4rem;
}

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--color-border-strong);
  padding: 0.15rem 0.5rem;
  margin-bottom: 0.6rem;
}

form p {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.9rem 0;
}

label {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  background: var(--color-control-bg);
  color: var(--color-text);
  border: 1px solid var(--color-control-border);
  border-radius: 0;
  padding: 0.5rem 0.7rem;
  font: inherit;
}

button {
  background: var(--color-button-bg);
  color: var(--color-button-text);
  border: 1px solid var(--color-button-bg);
  border-radius: 0;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

button:hover {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-text);
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

.flash-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.flash-messages li {
  border: 1px solid var(--color-border-strong);
  border-radius: 0;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.5rem;
}

.flash-messages li::before {
  content: "NOTICE — ";
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.widget-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .widget-list {
    grid-template-columns: 1fr;
  }
}

.widget-list .card.widget-full-width {
  grid-column: 1 / -1;
}

.inline-form {
  display: inline;
}

.inline-form + .inline-form {
  margin-left: 0.5rem;
}

/* /dashboards ("Configuration" eyebrow) page: shrink everything except
   the eyebrow label itself, which keeps its own explicit font-size. */
.configuration-page {
  font-size: 0.8rem;
}

.configuration-page h1 {
  font-size: 1.15rem;
}

.configuration-page h2 {
  font-size: 0.85rem;
}

.configuration-page .dashboard-name,
.configuration-page .dashboard-switcher {
  font-size: 0.7rem;
}

.dashboard-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.dashboard-switcher,
.dashboard-name {
  font-size: 0.85rem;
}

.dashboard-name {
  margin-right: 0.5rem;
}

.widget-list audio,
.widget-list video {
  width: 100%;
  max-width: 100%;
}

.feed-entries {
  font-size: 0.85rem;
  line-height: 1.4;
}

.code-editor {
  display: block;
  width: 100%;
  min-height: 140px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  resize: vertical;
}

.workarea-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}

.run-status {
  font-size: 0.75rem;
}

.code-output {
  margin: 0.6rem 0 0;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  background: var(--color-control-bg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
}

.file-repo-usage {
  margin-bottom: 0.75rem;
}

.usage-label {
  display: block;
  font-size: 0.72rem;
  margin-bottom: 0.3rem;
}

.usage-bar {
  height: 4px;
  background: var(--color-border);
}

.usage-bar-fill {
  height: 100%;
  background: var(--color-button-bg);
}

.file-repo-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.file-repo-folder {
  border: 1px solid var(--color-border);
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.folder-name {
  flex: 1;
}

.file-repo-file-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.file-repo-file {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0;
  font-size: 0.85rem;
}

.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-messages {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  padding: 0.75rem;
  margin-bottom: 0.6rem;
}

.chat-message {
  margin-bottom: 0.75rem;
}

.chat-message:last-child {
  margin-bottom: 0;
}

.chat-role {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.15rem;
}

.chat-content {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message-assistant .chat-content {
  font-weight: 600;
}

.chat-input {
  display: block;
  width: 100%;
  resize: vertical;
}

.chat-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}

.chat-status {
  font-size: 0.75rem;
}

.mic-btn.listening {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.mic-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-audio-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.chat-audio-toggle input {
  margin: 0;
}
