/*
 * kolo-intel visual identity.
 *
 * KOLO-adjacent but deliberately distinct: this is an internal tool, not the
 * marketplace. Dark navy ground, KOLO green for primary actions and positive
 * signal, orange for attention and mid-range values. System font stack per
 * the brief (Arial first).
 */

:root {
  --navy-900: #060d1a;
  --navy-800: #0b1628;
  --navy-700: #101f36;
  --surface: #101f36;
  --surface-raised: #16294a;
  --border: #1f3557;
  --border-strong: #2c4877;

  --green: #009a44;
  --green-bright: #16c264;
  --green-dim: rgba(0, 154, 68, 0.16);
  --orange: #f07300;
  --orange-dim: rgba(240, 115, 0, 0.16);
  --red: #e2564a;
  --red-dim: rgba(226, 86, 74, 0.16);

  --text: #eef3fb;
  --text-muted: #93a6c4;
  --text-faint: #63779a;

  --radius: 6px;
  --gap: 16px;
  --font: Arial, "Helvetica Neue", Helvetica, system-ui, sans-serif;
  --mono: "SF Mono", "Menlo", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--navy-900);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--green-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 12px 20px;
  background: var(--navy-800);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand {
  font-weight: bold;
  letter-spacing: 0.06em;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  color: var(--green-bright);
}

.brand-suffix {
  color: var(--text-faint);
  font-weight: normal;
}

/* `display: flex` would otherwise beat the user agent's [hidden] rule. */
.topbar[hidden] {
  display: none;
}

.nav {
  display: flex;
  gap: 4px;
  margin-right: auto;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 14px;
}

.nav a:hover {
  background: var(--surface-raised);
  color: var(--text);
  text-decoration: none;
}

.nav a.active {
  background: var(--green-dim);
  color: var(--green-bright);
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

h1 {
  font-size: 22px;
  margin: 0;
}

h2 {
  font-size: 16px;
  margin: 0 0 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

p {
  margin: 0 0 12px;
}

.muted {
  color: var(--text-muted);
}

.faint {
  color: var(--text-faint);
  font-size: 13px;
}

/* --- Cards and panels ------------------------------------------------ */

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

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

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: bold;
  line-height: 1.1;
}

.stat-label {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.stat.stat-orange {
  border-left-color: var(--orange);
}

/* --- Forms ----------------------------------------------------------- */

.field {
  margin-bottom: var(--gap);
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  background: var(--navy-900);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 9px 11px;
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.55;
}

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

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.field-row .field {
  flex: 1 1 160px;
  margin-bottom: 0;
}

/* --- Buttons --------------------------------------------------------- */

.button {
  display: inline-block;
  background: var(--green);
  color: #fff;
  border: 1px solid var(--green);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  padding: 9px 18px;
  cursor: pointer;
}

.button:hover:not(:disabled) {
  background: var(--green-bright);
  border-color: var(--green-bright);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.button-secondary:hover:not(:disabled) {
  background: var(--surface-raised);
  border-color: var(--border-strong);
}

.button-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  font-weight: normal;
}

.button-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-raised);
}

.button-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}

/* --- Tables ---------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

th {
  text-align: left;
  background: var(--navy-800);
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

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

tbody tr:hover {
  background: var(--surface-raised);
}

/* --- Badges ---------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--text-muted);
  white-space: nowrap;
}

.badge-high {
  background: var(--green-dim);
  color: var(--green-bright);
}

.badge-mid {
  background: var(--orange-dim);
  color: var(--orange);
}

.badge-low {
  background: var(--surface-raised);
  color: var(--text-faint);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* --- Messages -------------------------------------------------------- */

.alert {
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: var(--gap);
  font-size: 14px;
  border: 1px solid transparent;
}

.alert-error {
  background: var(--red-dim);
  border-color: var(--red);
  color: #ffd7d3;
}

.alert-success {
  background: var(--green-dim);
  border-color: var(--green);
  color: #c6f5da;
}

.alert-info {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--text-muted);
}

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

/* --- Misc ------------------------------------------------------------ */

.answer {
  white-space: pre-wrap;
  line-height: 1.65;
  background: var(--navy-900);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.post {
  white-space: pre-wrap;
  background: var(--navy-900);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.meta {
  color: var(--text-faint);
  font-size: 12px;
  font-family: var(--mono);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.login-title {
  text-align: center;
  margin-bottom: 24px;
  font-size: 26px;
  letter-spacing: 0.06em;
}

.spinner {
  color: var(--text-faint);
  font-size: 14px;
}

@media (max-width: 640px) {
  .main {
    padding: 16px 14px 48px;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }
}
