:root {
  --bg: #f0f1f3;
  --panel: #ffffff;
  --border: #e6e8ec;
  --text: #111318;
  --muted: #717785;

  /* NorrSpect brand — same palette as the desktop app (Plant Studio). */
  --primary:      #ccfc7e;   /* lime — button fills */
  --primary-h:    #b8f45a;   /* lime, hover */
  --primary-dark: #3e6b00;   /* dark green — accent text/links/badges */
  --primary-text: #182700;   /* near-black text on lime */
  --accent:       #3e6b00;
  --accent-soft:  #f2ffe0;

  --danger: #d93636;
  --danger-soft: #fbeceb;
  --warn: #8a5a00;
  --warn-soft: #fdf3df;
  --radius: 10px;
  font-family: "DM Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }

.brand { font-weight: 700; font-size: 15px; letter-spacing: .01em; display: flex; align-items: center; gap: 10px; }
.brand span { color: var(--accent); }
.brand-logo { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.login-card .brand-logo { width: 40px; height: 40px; border-radius: 9px; }

/* ---- Login ---- */

#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card .subtitle { margin: -8px 0 6px; color: var(--muted); }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

input, select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 600;
}
button:hover:not(:disabled) { background: var(--primary-h); }

button.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); font-weight: 500; }
button.secondary:hover:not(:disabled) { background: var(--bg); }
button.danger:hover:not(:disabled) { background: #c22e2e; }
button.danger { background: var(--danger); }
button.link-btn { background: none; color: var(--muted); padding: 0; text-decoration: underline; }
button:disabled { opacity: .55; cursor: default; }

.error { color: var(--danger); font-size: 13px; }

/* ---- Shell ---- */

#shell { display: flex; min-height: 100vh; }

#sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#sidebar .brand { margin-bottom: 18px; padding: 0 8px; }

#sidebar a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
#sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#sidebar a:hover:not(.active) { background: var(--bg); }

.sidebar-footer {
  margin-top: auto;
  padding: 10px 8px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#content { flex: 1; padding: 28px 36px; max-width: 1100px; }

h1 { font-size: 20px; margin: 0 0 18px; }
h2 { font-size: 15px; margin: 0 0 12px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select { min-width: 140px; }
.spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--bg); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-active { background: var(--accent-soft); color: var(--accent); }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-locked, .badge-revoked, .badge-expired { background: var(--danger-soft); color: var(--danger); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.full { grid-template-columns: 1fr; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }

.key-reveal {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 20px;
  letter-spacing: .06em;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  margin: 12px 0;
}

.muted { color: var(--muted); }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12px; }

.back-link { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,22,26,.4);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--panel); border-radius: var(--radius); padding: 24px;
  width: 460px; max-width: calc(100vw - 40px); max-height: calc(100vh - 40px); overflow: auto;
}

#toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 13px;
  z-index: 100;
}
#toast.error { background: var(--danger); }
