/* RoyOS — warm-donkere control-room stijl */

:root {
  --bg: #131009;
  --bg-2: #1c1710;
  --panel: rgba(32, 27, 19, 0.88);
  --panel-solid: #201b13;
  --line: #373023;
  --line-soft: #2a2419;
  --text: #ede4d3;
  --text-dim: #9b9078;
  --accent: #e9a53f;
  --accent-soft: rgba(233, 165, 63, 0.14);
  --green: #9dbb7a;
  --danger: #c96f5a;
  --radius: 14px;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --font-display: "Fraunces", serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 50% 118%, rgba(233, 165, 63, 0.16), transparent 65%),
    radial-gradient(800px 400px at 85% -10%, rgba(120, 96, 60, 0.12), transparent 60%),
    linear-gradient(var(--bg-2), var(--bg));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* fijne stippenraster als bureaublad-textuur */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(237, 228, 211, 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}

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

/* ---------- menubalk ---------- */

.menubar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  height: 40px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(19, 16, 9, 0.7);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 500;
  flex: 0 0 auto;
}

.menubar-left { display: flex; align-items: baseline; gap: 10px; }

.logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.menubar-version {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 1px 8px;
}

.menubar-right { display: flex; gap: 16px; font-size: 13px; color: var(--text-dim); }
.clock { color: var(--text); }

/* ---------- bureaublad ---------- */

.desktop { position: relative; flex: 1 1 auto; overflow: hidden; }

.hero {
  position: absolute;
  top: 7%;
  width: 100%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  user-select: none;
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateX(-50%) translateY(18px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hero-kicker {
  font-size: 12px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.hero-greeting {
  font-family: var(--font-display);
  font-weight: 340;
  font-size: clamp(42px, 6.5vw, 84px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.hero-greeting em {
  font-style: italic;
  color: var(--accent);
}

.hero-progress {
  margin-top: 26px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(32, 27, 19, 0.55);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  font-size: 13px;
  color: var(--text-dim);
}

.hero-progress:hover { border-color: var(--accent); color: var(--text); }

.ring { width: 30px; height: 30px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring-bg { stroke: var(--line); }
.ring-fg {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 119.4;
  stroke-dashoffset: 119.4;
  transition: stroke-dashoffset 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- ochtendbriefing ---------- */

.briefing {
  margin: 30px auto 0;
  max-width: 560px;
  width: min(560px, calc(100vw - 36px));
  text-align: left;
  background: rgba(32, 27, 19, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px 16px;
  backdrop-filter: blur(12px);
}

.briefing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.briefing-title {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.briefing-refresh {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.briefing-refresh:hover { color: var(--accent); background: var(--accent-soft); }

.briefing-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 32vh;
  overflow-y: auto;
}

.briefing-review {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.briefing-review:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- app-paneel (één app schermvullend) ---------- */

.hero-hidden { display: none; }

.app-panel {
  position: absolute;
  top: 18px;
  bottom: 96px; /* ruimte voor het dock */
  left: 50%;
  transform: translateX(-50%);
  width: min(1060px, calc(100vw - 28px));
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  animation: panelIn 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  overflow: hidden;
}

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

@keyframes panelIn {
  from { opacity: 0; transform: translateX(-50%) scale(0.98) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

.app-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  user-select: none;
  background: rgba(19, 16, 9, 0.35);
  flex: 0 0 auto;
}

.app-close {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  border-radius: 8px;
  width: 26px;
  height: 26px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  flex: 0 0 auto;
}

.app-close:hover { color: var(--danger); border-color: var(--danger); }

.app-title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.app-panel-body { flex: 1 1 auto; padding: 20px 22px; overflow-y: auto; min-height: 0; }

/* Chat en Notities vullen het paneel volledig, zonder eigen padding. */
.app-panel[data-app="chat"] .app-panel-body,
.app-panel[data-app="notities"] .app-panel-body {
  padding: 0;
  overflow: hidden;
  display: flex;
}

/* ---------- taken ---------- */

.day-label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  margin-bottom: 4px;
}

.day-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.task-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(19, 16, 9, 0.3);
  transition: border-color 0.15s, opacity 0.2s;
}

.task:hover { border-color: var(--line); }

.task-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--text-dim);
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 13px;
  transition: all 0.15s;
}

.task-check:hover { border-color: var(--accent); }

.task.done .task-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #1c1710;
}

.task-title { flex: 1; font-size: 14.5px; }

.task.done .task-title {
  color: var(--text-dim);
  text-decoration: line-through;
  text-decoration-color: rgba(233, 165, 63, 0.5);
}

.task-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 99px;
}

.task-del {
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 15px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  padding: 2px 4px;
}

.task:hover .task-del { opacity: 1; }
.task-del:hover { color: var(--danger); }

/* weekdag-knopjes bij vaste taken */
.task-template { flex-wrap: wrap; }

.day-chips { display: flex; gap: 3px; flex: 0 0 auto; }

.day-chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  width: 27px;
  padding: 4px 0;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
}

.day-chip:hover { border-color: var(--accent); }

.day-chip.on {
  background: var(--accent-soft);
  border-color: rgba(233, 165, 63, 0.5);
  color: var(--accent);
}

.empty-note {
  color: var(--text-dim);
  font-size: 13.5px;
  padding: 14px 4px;
  font-style: italic;
}

/* invoerregel */
.add-row { display: flex; gap: 8px; margin-top: 14px; }

.add-row input {
  flex: 1;
  background: rgba(19, 16, 9, 0.5);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
}

.add-row input:focus { border-color: var(--accent); }
.add-row input::placeholder { color: var(--text-dim); }

.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #1c1710;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: filter 0.15s;
}

.btn:hover { filter: brightness(1.1); }

.btn-ghost {
  background: transparent;
  color: var(--accent);
}

/* ---------- overzicht ---------- */

.history { display: flex; flex-direction: column; gap: 8px; }

.history-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }

.history-date { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); width: 84px; flex: 0 0 auto; }

.history-bar { flex: 1; height: 10px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }

.history-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(233, 165, 63, 0.55), var(--accent));
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.history-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); width: 40px; text-align: right; flex: 0 0 auto; }

/* ---------- API-verbruik ---------- */

.usage-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.usage-card {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(19, 16, 9, 0.3);
  padding: 14px 16px;
}

.usage-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.usage-card-title {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--accent);
}

.usage-card-model { font-size: 11px; color: var(--text-dim); }

.usage-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  font-size: 13.5px;
}

.usage-row-label { width: 92px; flex: 0 0 auto; color: var(--text-dim); }
.usage-row-tokens { flex: 1; font-size: 11.5px; color: var(--text-dim); }
.usage-row-cost { font-size: 13px; color: var(--text); }

.usage-calls {
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--text-dim);
}

.usage-day-cost { width: 74px; }

/* ---------- placeholder-apps ---------- */

.placeholder {
  text-align: center;
  padding: 26px 10px;
  margin: auto;
}

.placeholder-icon { font-size: 34px; color: var(--accent); display: block; margin-bottom: 12px; }

.placeholder h3 { font-family: var(--font-display); font-weight: 400; font-size: 21px; margin-bottom: 8px; }

.placeholder p { color: var(--text-dim); font-size: 13.5px; line-height: 1.55; }

/* ---------- chat ---------- */

.chat-layout { display: flex; flex: 1; width: 100%; min-height: 0; }

.chat-sidebar {
  width: 190px;
  flex: 0 0 auto;
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  background: rgba(19, 16, 9, 0.3);
}

.chat-new {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.chat-new button {
  flex: 1;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 7px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.chat-new button:hover { border-color: var(--accent); background: var(--accent-soft); }

.chat-list { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }

.chat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dim);
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}

.chat-item:hover { background: rgba(233, 165, 63, 0.08); color: var(--text); }
.chat-item.active { background: var(--accent-soft); color: var(--text); }

.chat-item-model { font-size: 11px; color: var(--accent); flex: 0 0 auto; }

.chat-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item-del {
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  padding: 0 2px;
}

.chat-item:hover .chat-item-del { opacity: 1; }
.chat-item-del:hover { color: var(--danger); }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg { max-width: 88%; line-height: 1.55; font-size: 14px; white-space: pre-wrap; overflow-wrap: break-word; }

.msg-user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid rgba(233, 165, 63, 0.3);
  border-radius: 14px 14px 4px 14px;
  padding: 9px 13px;
}

.msg-assistant {
  align-self: flex-start;
  background: rgba(19, 16, 9, 0.4);
  border: 1px solid var(--line-soft);
  border-radius: 14px 14px 14px 4px;
  padding: 9px 13px;
}

.msg-error {
  align-self: center;
  color: var(--danger);
  font-size: 12.5px;
  font-style: italic;
}

.msg-meta {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  margin: -6px 0 0 4px;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
  font-size: 13.5px;
  font-style: italic;
  padding: 20px;
  line-height: 1.6;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line-soft);
}

.chat-form textarea {
  flex: 1;
  resize: none;
  height: 44px;
  background: rgba(19, 16, 9, 0.5);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s;
}

.chat-form textarea:focus { border-color: var(--accent); }
.chat-form textarea::placeholder { color: var(--text-dim); }

.typing { color: var(--text-dim); font-style: italic; }

.setup-note {
  margin: auto;
  max-width: 420px;
  padding: 24px;
  text-align: left;
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.65;
}

.setup-note h3 { font-family: var(--font-display); font-weight: 400; color: var(--text); margin-bottom: 10px; font-size: 20px; }
.setup-note code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(19, 16, 9, 0.6);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--accent);
}

/* ---------- notities ---------- */

.notes-layout { display: flex; flex: 1; width: 100%; min-height: 0; }

.notes-sidebar {
  width: 220px;
  flex: 0 0 auto;
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  background: rgba(19, 16, 9, 0.3);
}

.notes-actions {
  display: flex;
  gap: 6px;
  padding: 10px 10px 6px;
}

.notes-actions button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.notes-actions button:hover { border-color: var(--accent); background: var(--accent-soft); }
.notes-actions .btn-daily { flex: 1; }

.notes-filter {
  margin: 4px 10px 8px;
  background: rgba(19, 16, 9, 0.5);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12.5px;
  padding: 6px 10px;
  outline: none;
}

.notes-filter:focus { border-color: var(--accent); }
.notes-filter::placeholder { color: var(--text-dim); }

.notes-list { flex: 1; overflow-y: auto; padding: 0 6px 10px; }

.note-folder {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 8px 4px;
}

.note-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.note-item:hover { background: rgba(233, 165, 63, 0.08); color: var(--text); }
.note-item.active { background: var(--accent-soft); color: var(--text); }

.notes-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.note-title {
  padding: 12px 16px 8px;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-editor {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  padding: 14px 16px;
}

.note-editor::placeholder { color: var(--text-dim); }
.note-editor:disabled { opacity: 0.5; }

.note-status {
  padding: 6px 16px 10px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  min-height: 26px;
}

/* ---------- dock ---------- */

.dock {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(32, 27, 19, 0.75);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  z-index: 900;
  animation: dockIn 0.7s 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes dockIn {
  from { opacity: 0; transform: translateX(-50%) translateY(24px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.dock-sep { width: 1px; height: 34px; background: var(--line); margin: 0 6px; }

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  padding: 7px 13px;
  border-radius: 12px;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.dock-item:hover {
  background: var(--accent-soft);
  color: var(--text);
  transform: translateY(-3px);
}

.dock-item.active {
  background: var(--accent-soft);
  color: var(--text);
}

.dock-icon { font-size: 19px; line-height: 1; color: var(--accent); }

.dock-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.05em; }

.dock-soon .dock-icon { color: var(--text-dim); }
