/* ═══════════════════════════════════════════════════════════════
   JAIME OS — Design System  v2
   Aesthetic: Deep Mineral — Navy Intelligence
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=JetBrains+Mono:wght@300;400;500&display=swap');

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

:root {
  /* Layout */
  --sw: 220px;
  --sw-collapsed: 52px;
  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;

  /* Background layers */
  --bg-0: #06080f;
  --bg-1: #090d1c;
  --bg-2: #0d1428;
  --bg-3: #121d38;
  --bg-4: #192840;

  /* Borders */
  --border-0: #121c30;
  --border-1: #1b2b45;
  --border-2: #263e62;

  /* Text */
  --text-0: #edf2fd;
  --text-1: #8aa4cc;
  --text-2: #4d6a96;
  --text-3: #2b3f60;

  /* Amber — primary accent */
  --amber:      #e8a020;
  --amber-2:    #c88810;
  --amber-3:    #a87008;
  --amber-dim:  rgba(232,160,32,0.09);
  --amber-glow: rgba(232,160,32,0.18);
  --amber-line: rgba(232,160,32,0.28);

  /* Electric blue — interactive */
  --electric:     #3d80ff;
  --electric-2:   #2860d8;
  --electric-dim: rgba(61,128,255,0.10);

  /* Semantic */
  --green:      #2ec878;
  --green-dim:  rgba(46,200,120,0.10);
  --red:        #e05252;
  --red-dim:    rgba(224,82,82,0.10);
  --orange:     #e88030;
  --orange-dim: rgba(232,128,48,0.10);

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}

/* ── Reset & base ── */
html { height: 100%; }
body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg-1);
  color: var(--text-0);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════
   LOGIN
══════════════════════════════════════════ */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Hexagonal grid background */
#login-view::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 700px 500px at 50% 50%, rgba(232,160,32,0.035) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52'%3E%3Cpolygon points='30,2 58,17 58,47 30,62 2,47 2,17' fill='none' stroke='%231b2b45' stroke-width='0.6'/%3E%3C/svg%3E");
  background-size: auto, 60px 52px;
  pointer-events: none;
}

#login-box {
  width: 100%;
  max-width: 340px;
  padding: 40px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 1;
  box-shadow: 0 32px 80px rgba(0,0,0,0.55);
}

/* Gold accent line */
#login-box::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
}

.login-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.65rem;
  color: var(--text-0);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  line-height: 1;
}
.login-wordmark em { color: var(--amber); font-style: normal; }

.login-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 28px;
}

#login-box label {
  display: block;
  color: var(--text-2);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

#login-box input[type="password"] {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-sm);
  color: var(--text-0);
  padding: 12px 14px;
  font-size: 1rem;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#login-box input[type="password"]:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

#login-btn {
  width: 100%;
  margin-top: 12px;
  background: var(--amber);
  color: #060810;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
#login-btn:hover  { background: var(--amber-2); }
#login-btn:active { transform: scale(0.99); }
#login-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

#login-error {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 10px;
  display: none;
}

#forgot-link {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 18px;
  color: var(--text-2);
  font-size: 0.78rem;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
  transition: color 0.15s;
}
#forgot-link:hover { color: var(--amber); }
#forgot-msg { text-align: center; font-size: 0.8rem; margin-top: 8px; display: none; }

/* ══════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════ */
#dashboard-view,
#app-view {
  display: none;
  height: 100vh;
  overflow: hidden;
}
#app-shell { display: flex; height: 100%; }

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
#sidebar {
  position: fixed;
  left: 0; top: 0;
  height: 100vh;
  width: var(--sw);
  background: var(--bg-0);
  border-right: 1px solid var(--border-0);
  padding: 0 0 16px;
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
  z-index: 50;
}
body.sb-collapsed #sidebar   { width: var(--sw-collapsed); }
body.sb-collapsed .nav-label { display: none; }
body.sb-collapsed #sidebar a { justify-content: center; padding: 10px 0; }
body.sb-collapsed #sb-logout { justify-content: center; padding: 10px 0; }
body.sb-collapsed .sb-wordmark { display: none; }
body.sb-collapsed .sb-dot     { display: none; }

.sb-header {
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--border-0);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sb-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-0);
  letter-spacing: -0.01em;
  white-space: nowrap;
  line-height: 1;
}
.sb-wordmark em { color: var(--amber); font-style: normal; }

.sb-dot {
  width: 6px; height: 6px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--amber-glow);
  flex-shrink: 0;
}

#sb-toggle {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
  line-height: 1;
  display: flex;
  align-items: center;
}
#sb-toggle:hover { background: var(--bg-3); color: var(--text-0); }

.sb-nav {
  padding: 0 8px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

#sidebar a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  position: relative;
}
#sidebar a:hover { background: var(--bg-3); color: var(--text-1); }
#sidebar a.active {
  background: var(--amber-dim);
  color: var(--amber);
  font-weight: 600;
}
#sidebar a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 5px; bottom: 5px;
  width: 2px;
  background: var(--amber);
  border-radius: 2px;
}

.nav-icon {
  width: 16px;
  text-align: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  opacity: 0.85;
}

#sb-footer {
  margin-top: auto;
  padding: 10px 8px 0;
  border-top: 1px solid var(--border-0);
  flex-shrink: 0;
}

#sb-logout {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
#sb-logout:hover { background: var(--red-dim); color: var(--red); }

/* ══════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════ */
#main-content {
  margin-left: var(--sw);
  padding: 32px;
  overflow-y: auto;
  height: 100vh;
  transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1);
}
body.sb-collapsed #main-content { margin-left: var(--sw-collapsed); }

#content-wrap {
  max-width: 880px;
  margin: 40px 40px 40px calc(var(--sw) + 20px);
  padding: 0 20px;
  transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1);
}
body.sb-collapsed #content-wrap { margin-left: calc(var(--sw-collapsed) + 20px); }

/* ══════════════════════════════════════════
   TYPOGRAPHY
══════════════════════════════════════════ */
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-0);
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}

h2 {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 28px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-0);
}

label {
  display: block;
  color: var(--text-2);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

/* ══════════════════════════════════════════
   FORM ELEMENTS
══════════════════════════════════════════ */
select,
input[type="text"],
input[type="date"],
input[type="password"],
textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-sm);
  color: var(--text-0);
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
select:focus,
input:focus,
textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}
select { cursor: pointer; }
input[type="date"] { color-scheme: dark; }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
button.primary,
.btn-primary {
  background: var(--amber);
  color: #06080e;
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
button.primary:hover, .btn-primary:hover { background: var(--amber-2); }
button.primary:active { transform: scale(0.99); }
button.primary:disabled, .btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-1);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-ghost:hover { border-color: var(--amber-line); color: var(--amber); background: var(--amber-dim); }

.btn-danger {
  background: transparent;
  border: 1px solid var(--border-1);
  color: var(--red);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-danger:hover { background: var(--red-dim); border-color: var(--red); }

.btn-cancel {
  background: var(--bg-3);
  border: none;
  color: var(--text-1);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.1s;
}
.btn-cancel:hover { background: var(--bg-4); }

.btn-save {
  background: var(--amber);
  border: none;
  color: #06080e;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-display);
}
.btn-save:hover { background: var(--amber-2); }

.inline-btn {
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border-1);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.82rem;
  font-family: var(--font-body);
  margin-bottom: 14px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.inline-btn:hover { color: var(--amber); border-color: var(--amber-line); background: var(--amber-dim); }

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6,8,15,0.78);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 28px;
  min-width: 320px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 28px 72px rgba(0,0,0,0.65);
  position: relative;
}
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 28px; right: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber-line), transparent);
}

.modal h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-0);
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}
.modal input {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  color: var(--text-0);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.modal input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-dim); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.modal-actions button { padding: 8px 18px; border-radius: var(--radius-sm); cursor: pointer; border: none; font-size: 0.85rem; }

/* ══════════════════════════════════════════
   STATUS / BADGES
══════════════════════════════════════════ */
.ok  { background: var(--green-dim); color: var(--green); border: 1px solid rgba(46,200,120,0.2); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.85rem; }
.err { background: var(--red-dim); color: var(--red); border: 1px solid rgba(224,82,82,0.2); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.85rem; }

.score-badge {
  display: inline-block;
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(46,200,120,0.2);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.copy-btn {
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border-1);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  cursor: pointer;
  margin-left: 8px;
  transition: background 0.1s;
}
.copy-btn:hover { background: var(--bg-4); }
.copy-btn.copied { background: var(--green-dim); color: var(--green); border-color: rgba(46,200,120,0.2); }

/* ══════════════════════════════════════════
   PROGRESS STEPS (pipeline)
══════════════════════════════════════════ */
.step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-0);
}
.step-row:last-child { border-bottom: none; }
.step-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.step-label { font-size: 0.85rem; color: var(--text-0); }
.step-pending .step-label { color: var(--text-3); }
.step-running .step-label { color: var(--orange); }
.step-done    .step-label { color: var(--green); }
.step-error   .step-label { color: var(--red); }

/* ══════════════════════════════════════════
   RESULT SECTIONS
══════════════════════════════════════════ */
.section {
  background: var(--bg-2);
  border: 1px solid var(--border-0);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.section:hover { border-color: var(--border-1); }
.section-title {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.item {
  padding: 7px 0;
  border-bottom: 1px solid var(--border-0);
  font-size: 0.86rem;
  color: var(--text-0);
}
.item:last-child { border: none; }
.item-meta { font-size: 0.73rem; color: var(--text-2); margin-top: 3px; font-family: var(--font-mono); }

pre {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-1);
  line-height: 1.65;
  max-height: 320px;
  overflow-y: auto;
}

/* ══════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════ */
.mono { font-family: var(--font-mono); }

a.view-link { color: var(--amber); font-size: 0.8rem; text-decoration: none; }
a.view-link:hover { text-decoration: underline; }

.empty { color: var(--text-3); font-size: 0.85rem; padding: 8px 0; }

/* ══════════════════════════════════════════
   MOBILE
══════════════════════════════════════════ */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 54px;
    width: 100% !important;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--border-0);
    padding: 0 8px;
    z-index: 100;
    justify-content: space-evenly;
  }
  .sb-header { display: none !important; }
  .sb-nav { padding: 0; display: flex; align-items: center; overflow-x: auto; flex: 1; }
  #sidebar a { padding: 8px 10px; flex-shrink: 0; margin-bottom: 0; }
  #sb-toggle { display: none; }
  #sb-footer { display: none !important; }
  #main-content { margin-left: 0 !important; padding: 16px; padding-top: 66px; height: auto; }
  #content-wrap { margin: 0 !important; padding: 16px; padding-top: 66px; max-width: 100%; }
}
@media (max-width: 480px) {
  .nav-label { display: none; }
  #sidebar { justify-content: space-evenly; }
  #sidebar a { padding: 8px; }
}
