/* Ring Cloud — minimal SPA shell. Will absorb tokens from local Ring's
   command-center.css when more panes lift over. */

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #0e0e10;
  color: #e8e8ec;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid #25252b;
  background: #16161a;
}
.topbar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.4px;
}
.topbar-kicker {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 3px;
  color: #6a6a72;
  text-transform: uppercase;
}
.topbar-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.4px;
  padding: 3px 9px;
  border-radius: 12px;
  background: #1f1f24;
  color: #b8b8be;
  white-space: nowrap;
}
.chip-muted { color: #6a6a72; }
.chip-ok { background: #163021; color: #6dd99e; }
.chip-err { background: #321616; color: #e58383; }

main { flex: 1; padding: 24px; max-width: 960px; width: 100%; margin: 0 auto; }

.pane { background: #16161a; border-radius: 6px; padding: 20px 24px; }
.pane-head { margin-bottom: 16px; }
.pane-head h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.pane-meta { margin: 0; font-size: 12px; color: #6a6a72; }

.empty {
  padding: 40px 16px;
  text-align: center;
  color: #6a6a72;
  font-size: 13px;
}

/* Journal */
.journal-list { display: flex; flex-direction: column; gap: 6px; }
.j-row {
  padding: 10px 14px;
  border-left: 3px solid transparent;
  background: #0f0f12;
  border-radius: 0 4px 4px 0;
}
.j-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
.j-row-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.j-row-meta { color: #6a6a72; font-size: 11px; white-space: nowrap; font-family: ui-monospace, Menlo, Consolas, monospace; }
.j-row-body { margin-top: 6px; font-size: 13px; line-height: 1.45; color: #c8c8cf; white-space: pre-wrap; word-break: break-word; }

.j-row code { font-family: ui-monospace, Menlo, Consolas, monospace; background: #1c1c20; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

.j-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 3px;
  background: #25252b;
  color: #b8b8be;
}
.j-row.k-prompt        { border-left-color: #4a90e2; } .j-badge.k-prompt        { background: #14233b; color: #6ea8e6; }
.j-row.k-reply         { border-left-color: #50c878; } .j-badge.k-reply         { background: #133b1f; color: #6dd99e; }
.j-row.k-tool          { border-left-color: #8b8b94; } .j-badge.k-tool          { background: #2a2a30; color: #b8b8be; }
.j-row.k-tool-error    { border-left-color: #d04040; } .j-badge.k-tool-error    { background: #3b1414; color: #e58383; }
.j-row.k-file          { border-left-color: #a18bd0; } .j-badge.k-file          { background: #2a2438; color: #c5b1e8; }
.j-row.k-challenge     { border-left-color: #d68910; } .j-badge.k-challenge     { background: #3b2510; color: #e3b25c; }
.j-row.k-risk          { border-left-color: #d04040; } .j-badge.k-risk          { background: #3b1414; color: #e58383; }
.j-row.k-suggestion    { border-left-color: #d68910; } .j-badge.k-suggestion    { background: #3b2510; color: #e3b25c; }
.j-row.k-session-start { border-left-color: #3a3a44; } .j-badge.k-session-start { background: #25252b; color: #8b8b94; }
.j-row.k-session-end   { border-left-color: #3a3a44; } .j-badge.k-session-end   { background: #25252b; color: #8b8b94; }

.j-severity {
  font-size: 10px;
  text-transform: lowercase;
  padding: 1px 5px;
  border-radius: 3px;
  background: #25252b;
}
.j-severity-strong { background: #3b1414; color: #e58383; }
.j-severity-medium { background: #3b2510; color: #e3b25c; }

/* Layout helpers */
.pane + .pane { margin-top: 24px; }
.pane-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }

/* Buttons */
.btn-primary, .btn-ghost {
  font: inherit; font-size: 12px; font-weight: 500;
  padding: 7px 14px; border-radius: 4px; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: #2c5fb8; color: #fff; }
.btn-primary:hover { background: #3470d2; }
.btn-ghost { background: transparent; color: #b8b8be; border-color: #2a2a30; }
.btn-ghost:hover { background: #1f1f24; color: #e8e8ec; }
.btn-row-action {
  background: transparent; border: 1px solid #25252b; color: #b8b8be;
  font-size: 11px; padding: 3px 9px; border-radius: 3px; cursor: pointer;
}
.btn-row-action:hover { background: #1f1f24; color: #e8e8ec; }
.btn-row-action.danger:hover { background: #3b1414; color: #e58383; border-color: #5a1f1f; }

/* Keys table */
.keys-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }
.keys-table th, .keys-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #1f1f24; }
.keys-table th { color: #6a6a72; font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; font-size: 10px; }
.keys-table td.faint { color: #6a6a72; }
.keys-table .status-active { color: #6dd99e; }
.keys-table .status-expired, .keys-table .status-revoked { color: #e58383; }
.keys-table tr.revoked td { opacity: 0.6; }
.keys-table .empty { text-align: center; color: #6a6a72; padding: 24px 16px; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.modal-card {
  position: relative; background: #16161a; border: 1px solid #25252b; border-radius: 6px;
  padding: 20px 24px; max-width: 600px; width: 100%;
  max-height: calc(100vh - 32px); overflow-y: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-x { background: none; border: none; color: #6a6a72; font-size: 22px; cursor: pointer; padding: 0 6px; }
.modal-x:hover { color: #e8e8ec; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 12px; }
.field span { color: #b8b8be; }
.field input {
  background: #0e0e10; border: 1px solid #25252b; color: #e8e8ec;
  padding: 7px 10px; border-radius: 4px; font: inherit; font-size: 13px;
}
.field input:focus { outline: 1px solid #3470d2; border-color: #3470d2; }

.key-plaintext {
  background: #0a0a0c; border: 1px solid #25252b; color: #6dd99e;
  padding: 12px 14px; border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px;
  word-break: break-all; white-space: pre-wrap; margin: 8px 0;
}

.setup-head { margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: #e8e8ec; }
.setup-tabs { display: flex; gap: 6px; margin-bottom: 6px; }
.setup-tab {
  background: transparent; border: 1px solid #25252b; color: #b8b8be;
  font-size: 11px; padding: 4px 10px; border-radius: 3px; cursor: pointer;
}
.setup-tab.active { background: #1f1f24; color: #e8e8ec; border-color: #2c5fb8; }
.setup-script {
  background: #0a0a0c; border: 1px solid #25252b; color: #c8c8cf;
  padding: 12px 14px; border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
  overflow-x: auto; margin: 0;
}

.chip-link {
  display: inline-block; padding: 0 6px; margin-left: 6px;
  color: #b8b8be; text-decoration: none; font-weight: 500;
  border-radius: 8px;
}
.chip-link:hover { background: #2a2a30; color: #e8e8ec; }
.chip-link-primary { color: #6ea8e6; }
.chip-link-primary:hover { color: #9ec0ee; background: #14233b; }
