/* wretches-and-kings — resistance theme */

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

:root {
  --bg:          #f5f0e1;
  --bg-subtle:   #ebe5d2;
  --border:      #c4b99a;
  --text:        #2c1e0f;
  --muted:       #7a6b55;
  --accent:      #8b1a1a;
  --accent-h:    #6e1010;
  --danger:      #a31515;
  --success:     #4a6741;
  --warn:        #b5751a;
  --ink:         #1a0f05;
  --radius:      2px;
  --font:        'Source Sans 3', system-ui, -apple-system, sans-serif;
  --font-heading:'Anton', Impact, 'Arial Narrow', sans-serif;
  --mono:        ui-monospace, 'Cascadia Code', monospace;
  --nav-w:       220px;
  --grain-opacity: 0.04;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #1a1510;
    --bg-subtle:   #262015;
    --border:      #3d3529;
    --text:        #e8e0d0;
    --muted:       #9a8e7a;
    --accent:      #c43c3c;
    --accent-h:    #e05050;
    --ink:         #0d0804;
    --danger:      #e04040;
    --success:     #6b8f5e;
    --warn:        #d4922e;
    --grain-opacity: 0.06;
  }
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: radial-gradient(ellipse at 30% 20%, rgba(210,195,165,0.25), transparent 70%), var(--bg);
  display: flex;
}

/* ── Grain overlay ───────────────────────────────────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--grain-opacity);
  filter: url(#grain-filter);
}

/* ── Typography ──────────────────────────────────────────────────────── */

h1 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}

h2 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* ── Nav ──────────────────────────────────────────────────────────────── */

nav {
  width: var(--nav-w);
  min-height: 100vh;
  padding: 24px 16px;
  border-right: 3px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

nav .logo {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 8px 14px;
  border-bottom: 3px solid var(--accent);
  margin-bottom: 10px;
  color: var(--text);
  text-decoration: none;
}

nav a {
  display: block;
  padding: 7px 10px;
  border-left: 3px solid transparent;
  border-radius: 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.15s, border-color 0.15s;
}

nav a:hover {
  color: var(--accent);
  background: transparent;
}

nav a.active {
  border-left-color: var(--accent);
  color: var(--text);
  background: transparent;
}

nav .spacer { flex: 1; }

/* ── Main content ────────────────────────────────────────────────────── */

main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  max-width: 1100px;
}

/* ── Tables ──────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 3px solid var(--text);
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

tbody td {
  padding: 9px 12px;
  border-bottom: 1px dashed var(--border);
  vertical-align: middle;
}

tbody tr:hover td { background: rgba(139, 26, 26, 0.04); }

@media (prefers-color-scheme: dark) {
  tbody tr:hover td { background: rgba(196, 60, 60, 0.06); }
}

tbody tr:last-child td { border-bottom: none; }

/* ── Status badges (stamp aesthetic) ─────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius);
  border: 2px solid currentColor;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: transparent;
}

.badge-new        { color: #4a6741; }
.badge-pipeline   { color: #5c4a1e; }
.badge-evaluated  { color: #7a5a0d; }
.badge-applied    { color: #2d5a2d; }
.badge-responded  { color: #1e6b4a; }
.badge-interview  { color: #1a5c3a; }
.badge-offer      { color: #166534; }
.badge-rejected   { color: #8b1a1a; }
.badge-discarded  { color: #7a6b55; }
.badge-skip       { color: #9a8e7a; }

@media (prefers-color-scheme: dark) {
  .badge-new        { color: #7db86e; }
  .badge-pipeline   { color: #c4a64e; }
  .badge-evaluated  { color: #d4a22e; }
  .badge-applied    { color: #5eae5e; }
  .badge-responded  { color: #4ec99a; }
  .badge-interview  { color: #40b878; }
  .badge-offer      { color: #4ade80; }
  .badge-rejected   { color: #e05050; }
  .badge-discarded  { color: #9a8e7a; }
  .badge-skip       { color: #7a6e5a; }
}

/* ── Buttons ─────────────────────────────────────────────────────────── */

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 2px 2px 0 var(--ink);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

button:hover, .btn:hover {
  background: var(--accent-h);
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(1px, 1px);
}

button.secondary, .btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 var(--border);
}

button.secondary:hover, .btn-secondary:hover {
  background: var(--bg-subtle);
  box-shadow: 1px 1px 0 var(--border);
}

button.danger { background: var(--danger); }
button.danger:hover { background: #8b1212; }

@media (prefers-color-scheme: dark) {
  button.danger:hover { background: #c43030; }
}

button.sm { padding: 4px 10px; font-size: 11px; }

/* ── Forms ───────────────────────────────────────────────────────────── */

form { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
}

select {
  padding-right: 28px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12px;
  background:
    repeating-linear-gradient(
      transparent, transparent 23px,
      var(--border) 23px, var(--border) 24px
    ),
    var(--bg);
}

/* ── Tag input ───────────────────────────────────────────────────────── */

.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tag-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.tag-input .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  cursor: default;
}

.tag-input .tag-remove {
  cursor: pointer;
  opacity: 0.5;
  font-size: 13px;
  line-height: 1;
  transition: opacity 0.15s;
}

.tag-input .tag-remove:hover { opacity: 1; }

.tag-input input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 2px 4px !important;
  font-size: 13px;
  background: transparent;
  flex: 1;
  min-width: 120px;
}

/* ── Notification feed ───────────────────────────────────────────────── */

.feed { display: flex; flex-direction: column; gap: 10px; }

.feed-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg);
  box-shadow: 1px 1px 0 var(--border);
  transition: box-shadow 0.15s;
}

.feed-item:hover {
  box-shadow: 2px 2px 0 var(--border);
}

.feed-item.unread { border-left: 4px solid var(--accent); }

.feed-item-body { flex: 1; min-width: 0; }

.feed-item-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.feed-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Toolbar / filter bar ────────────────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar input[type="text"] { max-width: 240px; }

.toolbar select { width: auto; max-width: 200px; }

select:not(form select) { width: auto; }

/* ── Utility ─────────────────────────────────────────────────────────── */

.muted  { color: var(--muted); }
.mono   { font-family: var(--mono); font-size: 12px; }
.score  { font-weight: 700; color: var(--accent); }
.empty  { text-align: center; padding: 48px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--muted);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login page ──────────────────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(210,195,165,0.3), transparent 70%), var(--bg-subtle);
}

.login-card {
  background: var(--bg);
  border: 3px solid var(--text);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 360px;
  box-shadow: 4px 4px 0 var(--ink);
}

.login-card h1 {
  font-size: 28px;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.login-card p {
  color: var(--muted);
  margin-bottom: 28px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
}

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

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  body { flex-direction: column; }
  nav {
    width: 100%;
    min-height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px;
    border-right: none;
    border-bottom: 3px solid var(--border);
  }
  nav .logo { padding-bottom: 0; border: none; margin-bottom: 0; }
  nav a { border-left: none; border-bottom: 3px solid transparent; }
  nav a.active { border-left-color: transparent; border-bottom-color: var(--accent); }
  main { padding: 16px; }
}
