:root {
  --bg: #0b1220;
  --bg-elevated: #121b2e;
  --bg-card: #17223a;
  --border: #263453;
  --text: #e6ebf5;
  --text-dim: #9fb0cc;
  --text-faint: #6b7c9c;
  --accent: #2dd4bf;
  --accent-2: #0ea5e9;
  --accent-warn: #f59e0b;
  --danger: #f87171;
  --radius: 10px;
  --max-width: 1180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  min-height: 100%;
}

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

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Header ---- */

header.site-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg));
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  max-width: var(--max-width);
  margin: 0 auto;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.brand img { height: 42px; width: 42px; display: block; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand .brand-title { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.02em; }
.brand .brand-sub { font-size: 0.72rem; color: var(--text-faint); letter-spacing: 0.08em; text-transform: uppercase; }

.header-search {
  flex: 1 1 320px;
  min-width: 220px;
}

.header-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}
.header-nav a { color: var(--text-dim); }
.header-nav a.active { color: var(--accent); }

.role-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}
.role-badge.editor { color: var(--accent); border-color: rgba(45, 212, 191, 0.4); }

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.logout-btn:hover { border-color: var(--accent-2); color: var(--text); }

/* ---- Search ---- */

.search-box {
  position: relative;
}
.search-box input[type="text"] {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
}
.search-box input[type="text"]:focus {
  border-color: var(--accent-2);
}

/* ---- Layout ---- */

main { padding: 24px 0 60px; }

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-bottom: 18px;
}
.breadcrumbs a { color: var(--text-dim); }
.breadcrumbs .sep { margin: 0 6px; color: var(--text-faint); }

h1.page-title {
  font-size: 1.6rem;
  margin: 0 0 6px;
}
.page-subtitle {
  color: var(--text-dim);
  margin: 0 0 22px;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: block;
  color: var(--text);
  transition: border-color 0.15s, transform 0.1s;
}
.tile:hover { border-color: var(--accent-2); text-decoration: none; transform: translateY(-1px); }
.tile .tile-title { font-weight: 600; font-size: 1.02rem; }
.tile .tile-meta { color: var(--text-faint); font-size: 0.8rem; margin-top: 4px; }

.industry-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 7px;
  background: rgba(45, 212, 191, 0.12);
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 8px;
  font-weight: 700;
}

/* ---- Articles ---- */

.article-list { display: flex; flex-direction: column; gap: 12px; }

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
}
.article-card:hover { border-color: var(--accent-2); }

.article-card .article-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 6px;
  color: var(--text);
}

.article-card .article-summary {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.5;
}

.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent-2);
  border: 1px solid rgba(14, 165, 233, 0.35);
}
.badge.sample {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warn);
  border-color: rgba(245, 158, 11, 0.35);
}
.badge.tag {
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  border-color: var(--border);
}

.empty-state {
  color: var(--text-faint);
  padding: 40px 0;
  text-align: center;
}

/* ---- Modal (article detail) ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 18, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 50;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 680px;
  width: 100%;
  padding: 26px 28px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal h2 { margin: 0 0 6px; font-size: 1.3rem; padding-right: 24px; }
.modal .modal-meta { color: var(--text-faint); font-size: 0.82rem; margin-bottom: 14px; }
.modal .modal-summary { color: var(--text); font-size: 1rem; line-height: 1.55; margin-bottom: 14px; }
.modal .modal-body { color: var(--text-dim); font-size: 0.93rem; line-height: 1.6; white-space: pre-wrap; margin-bottom: 16px; }
.modal .modal-source { font-size: 0.88rem; }

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

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card img { height: 56px; margin-bottom: 14px; }
.login-card h1 { font-size: 1.25rem; margin: 0 0 4px; }
.login-card .login-sub { color: var(--text-faint); font-size: 0.85rem; margin-bottom: 22px; }
.login-card input[type="password"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 8px;
  outline: none;
  margin-bottom: 12px;
}
.login-card input[type="password"]:focus { border-color: var(--accent-2); }
.login-card button {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #04121a;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.login-card button:hover { filter: brightness(1.05); }
.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 10px;
  min-height: 1.2em;
}

/* ---- Admin ---- */

.admin-layout { display: grid; grid-template-columns: 1fr; gap: 22px; }
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.panel h2 { margin: 0 0 16px; font-size: 1.1rem; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 6px; }
.form-row input[type="text"],
.form-row input[type="url"],
.form-row input[type="date"],
.form-row select,
.form-row textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 7px;
  outline: none;
}
.form-row textarea { resize: vertical; min-height: 70px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--accent-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #04121a;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn.secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
}
.btn.danger {
  background: none;
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--danger);
  font-weight: 600;
}

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.admin-table th, table.admin-table td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.admin-table th { color: var(--text-faint); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
table.admin-table td.actions { white-space: nowrap; }
table.admin-table td.actions button { margin-right: 6px; }

.toast {
  position: fixed;
  bottom: 20px; right: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 100;
  max-width: 320px;
}
.toast.error { border-color: var(--danger); }
.toast.hidden { display: none; }

.footer-note {
  color: var(--text-faint);
  font-size: 0.78rem;
  text-align: center;
  padding: 20px 0 10px;
}
