/* sponsor-festa-cms — Brutalist Terminal OS theme
   warm beige + hard black borders + dot-matrix numerals
   self-contained, no Tailwind, no external fonts */

:root {
  --bg: #e8e6df;
  --bg-soft: #efede6;
  --bg-tint: #d8d6cf;
  --surface: #ffffff;
  --surface-soft: rgba(255,255,255,0.5);
  --surface-tint: #f5f5f0;
  --ink: #000000;
  --text: #000000;
  --muted: #6b7280;
  --muted-light: #9ca3af;
  --muted-faint: #c4c2bb;
  --alert: #ef4444;
  --ok: #22c55e;

  --shadow-card: 4px 4px 0 rgba(0,0,0,0.05);
  --shadow-bold: 8px 8px 0 rgba(0,0,0,0.1);
  --shadow-massive: 16px 16px 0 rgba(0,0,0,1);

  --mono: ui-monospace, "JetBrains Mono", "IBM Plex Mono", "SF Mono", "Cascadia Code", "Liberation Mono", Menlo, Consolas, "Noto Sans JP", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: #000; color: var(--bg); }

h1, h2, h3, h4 { font-weight: 700; margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.muted { color: var(--muted); }
.small { font-size: 11px; }
.tabular { font-variant-numeric: tabular-nums; }

/* ============== Dot-Matrix Number ============== */

.dot-str {
  display: inline-flex;
  align-items: flex-end;
  flex-wrap: nowrap;
  white-space: nowrap;
  line-height: 1;
  overflow: hidden;
}
.dot-ch {
  display: inline-grid;
  gap: 1px;
  margin-right: 3px;
}
.dot-ch .dot {
  display: block;
  background: currentColor;
  opacity: 1;
}
.dot-ch .dot.off { opacity: 0.04; }

/* ============== Terminal Status Bar (very top) ============== */

.term-status {
  height: 24px;
  background: #000;
  color: var(--bg);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid #000;
  overflow: hidden;
  white-space: nowrap;
  gap: 1rem;
}
.term-status .alert {
  color: #ff4d4d;
  animation: pulse 1.5s infinite;
}
.term-status .italic { font-style: italic; }
.term-status .sep {
  padding-left: 1rem;
  border-left: 1px solid rgba(232,230,223,0.3);
}
.term-status .spacer { flex: 1; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes ping {
  0% { opacity: 1; transform: scale(1); }
  75%, 100% { opacity: 0; transform: scale(2); }
}

@media (max-width: 640px) {
  .term-status .sep:nth-of-type(n+2) { display: none; }
}

/* ============== App Header ============== */

.app-header {
  background: var(--bg);
  border-bottom: 1px solid #000;
}
.app-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.brand-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-mark {
  background: #000;
  color: var(--bg);
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0;
}
.brand-text { line-height: 1.1; }
.brand-text h1 {
  color: #000;
  font-size: 13px;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.brand-text .meta {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: -0.01em;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2px;
}
@media (max-width: 640px) { .brand-text { display: none; } }

.top-nav { display: flex; gap: 2rem; }
.top-nav a {
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.top-nav a.active {
  color: #000;
  border-bottom-color: #000;
}
.top-nav a:hover { color: #000; }
@media (max-width: 1023px) { .top-nav { display: none; } }

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #000;
  background: #fff;
  padding: 4px 8px;
  font-size: 10px;
}
.user-dot {
  width: 6px;
  height: 6px;
  background: var(--ok);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}
.user-chip a {
  color: var(--muted);
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--muted-faint);
}
.user-chip a:hover { color: #000; }

/* ============== Bottom Nav (mobile) ============== */

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: none;
  background: #000;
  color: var(--bg);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bg);
  border-right: 1px solid rgba(232,230,223,0.2);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bottom-nav a:last-child { border-right: 0; }
.bottom-nav a.active { background: var(--bg); color: #000; }
@media (max-width: 1023px) {
  .bottom-nav { display: flex; }
  .app-body { padding-bottom: 5rem; }
}

/* ============== Main Container ============== */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
@media (min-width: 640px) {
  .container { padding: 1.5rem; gap: 2rem; }
}

/* ============== Page Title (massive brutalist hero) ============== */

.page-hero {
  border: 1px solid #000;
  background: #fff;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  box-shadow: var(--shadow-massive);
  position: relative;
}
@media (min-width: 1024px) {
  .page-hero { flex-direction: row; align-items: center; justify-content: space-between; padding: 2.5rem; }
}
.page-hero .security {
  font-size: 10px;
  font-weight: 900;
  color: var(--muted-light);
  letter-spacing: 0.5em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.page-hero h1 {
  font-size: 2.25rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0;
  color: #000;
}
@media (min-width: 768px) { .page-hero h1 { font-size: 3.5rem; } }
@media (min-width: 1024px) { .page-hero h1 { font-size: 4.5rem; } }
.page-hero .badges {
  display: flex;
  align-items: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-hero .badge-op {
  background: #000;
  color: #fff;
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.page-hero .badge-meta {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  padding-left: 1rem;
  border-left: 1px solid #000;
}

.btn-hero {
  background: #000;
  color: var(--bg);
  border: 2px solid #000;
  padding: 18px 36px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 8px 8px 0 rgba(0,0,0,0.1);
  transition: transform 0.1s, background 0.15s, color 0.15s, box-shadow 0.1s;
  display: inline-flex;
  align-items: center;
}
.btn-hero:hover {
  background: var(--bg);
  color: #000;
}
.btn-hero:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}
@media (max-width: 1023px) { .btn-hero { width: 100%; justify-content: center; } }

/* ============== Module (card) ============== */

.module {
  border: 1px solid #000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.module-head {
  border-bottom: 1px solid #000;
  background: #fff;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.module-head h2 {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
}
.module-head h2::before {
  content: "■";
  margin-right: 8px;
}
.module-head .en {
  color: var(--muted-light);
  margin-left: 8px;
  font-weight: 400;
}
.module-head .tag {
  background: #f3f4f6;
  border: 1px solid #000;
  padding: 0 8px;
  font-weight: 900;
}

/* ============== Layout Grid ============== */

.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}
@media (min-width: 1280px) {
  .dash-grid { grid-template-columns: 2fr 1fr; }
}
.dash-grid-left { display: flex; flex-direction: column; gap: 2rem; min-width: 0; }
.dash-grid-right { min-width: 0; }

/* ============== Collection Status (metrics) ============== */

.metric-row {
  display: grid;
  grid-template-columns: 1fr;
  border-bottom: 1px solid #000;
}
@media (min-width: 640px) {
  .metric-row { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .metric-row { grid-template-columns: repeat(4, 1fr); }
}
.metric {
  padding: 20px;
  background: var(--surface-soft);
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100px;
}
.metric:last-child { border-right: 0; }
@media (max-width: 1023px) {
  .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-last-child(-n+2) { border-bottom: 1px solid #000; }
}
@media (max-width: 639px) {
  .metric { border-right: 0; }
}
.metric:hover { background: #fff; }
.metric.tinted { background: var(--bg-tint); }
.metric .label {
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}
.metric .value-wrap {
  display: flex;
  align-items: flex-end;
  min-height: 40px;
  overflow: hidden;
  color: #000;
}
.metric.alert .value-wrap { color: var(--alert); }

/* ============== Progress Bar (terminal style) ============== */

.progress-block { padding: 16px; background: #fff; }
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.progress-track {
  width: 100%;
  height: 16px;
  border: 1px solid #000;
  background: var(--bg);
  display: flex;
  align-items: center;
  padding: 2px;
  position: relative;
  overflow: hidden;
}
.progress-fill { height: 100%; background: #000; }
.progress-ticks {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  pointer-events: none;
  opacity: 0.2;
}
.progress-ticks i {
  width: 1px;
  height: 100%;
  background: #000;
}

/* ============== Pipeline Matrix (status grid) ============== */

.pipeline {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: #000;
}
@media (min-width: 640px) {
  .pipeline { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .pipeline { grid-template-columns: repeat(6, 1fr); }
}
.pipe-cell {
  background: #fff;
  padding: 16px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pipe-cell:hover { background: #000; color: #fff; }
.pipe-cell:hover .pipe-label { color: rgba(255,255,255,0.6); }
.pipe-cell:hover .pipe-watermark { color: rgba(255,255,255,0.1); }
.pipe-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  z-index: 2;
}
.pipe-value {
  align-self: flex-end;
  position: relative;
  z-index: 2;
}
.pipe-watermark {
  position: absolute;
  bottom: -12px;
  left: -8px;
  font-size: 2.5rem;
  font-weight: 900;
  font-style: italic;
  color: #f3f4f6;
  user-select: none;
  pointer-events: none;
  z-index: 1;
}
.pipe-cell.spacer { background: var(--surface-tint); opacity: 0.3; cursor: default; }
.pipe-cell.spacer:hover { background: var(--surface-tint); }
.pipe-cell.spacer i {
  width: 100%;
  height: 100%;
  border: 1px dashed rgba(0,0,0,0.2);
  display: block;
}

/* 6-phase variant: 6 列固定、各 phase に色 */
.pipeline-phases {
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) { .pipeline-phases { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .pipeline-phases { grid-template-columns: repeat(6, 1fr); } }
.pipeline-phases .pipe-cell { min-height: 120px; padding: 18px; }
.pipeline-phases .pipe-label { font-size: 11px; font-weight: 800; letter-spacing: 0.05em; }

.pipe-cell.phase-untouched   { background: #f4ede3; }
.pipe-cell.phase-in_progress { background: #fff0d8; }
.pipe-cell.phase-agreed      { background: #d6f5e7; }
.pipe-cell.phase-invoicing   { background: #ede2fc; }
.pipe-cell.phase-paid        { background: #c8efd0; }
.pipe-cell.phase-closed      { background: #ede5dc; opacity: 0.85; }

.pipe-cell.phase-untouched:hover, .pipe-cell.phase-in_progress:hover,
.pipe-cell.phase-agreed:hover, .pipe-cell.phase-invoicing:hover,
.pipe-cell.phase-paid:hover, .pipe-cell.phase-closed:hover {
  background: #000;
  color: #fff;
  opacity: 1;
}
.pipe-cell.phase-untouched:hover .pipe-label,
.pipe-cell.phase-in_progress:hover .pipe-label,
.pipe-cell.phase-agreed:hover .pipe-label,
.pipe-cell.phase-invoicing:hover .pipe-label,
.pipe-cell.phase-paid:hover .pipe-label,
.pipe-cell.phase-closed:hover .pipe-label { color: rgba(255,255,255,0.7); }

/* ============== Action Required (alert list) ============== */

.actions-list {
  display: flex;
  flex-direction: column;
  background: var(--surface-soft);
  flex: 1;
  margin: 0;
  padding: 0;
  list-style: none;
}
.actions-list li { border-bottom: 1px solid rgba(0,0,0,0.2); }
.actions-list li:last-child { border-bottom: 0; }
.actions-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
}
.actions-list a:hover { background: #000; color: #fff; }
.actions-list a:hover .a-idx { color: rgba(255,255,255,0.4); }
.actions-list .a-left { display: flex; align-items: center; min-width: 0; margin-right: 8px; }
.actions-list .a-idx {
  font-size: 8px;
  font-weight: 700;
  color: var(--muted-light);
  margin-right: 16px;
}
.actions-list .a-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============== Footer Terminal Info ============== */

.term-footer {
  margin-top: 3rem;
  border-top: 4px solid #000;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #000;
}
@media (min-width: 768px) {
  .term-footer { flex-direction: row; justify-content: space-between; align-items: center; }
}
.term-footer .left { display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; }
.term-footer .right { display: flex; flex-direction: column; align-items: flex-end; }
.term-footer .ping {
  display: inline-flex;
  align-items: center;
  position: relative;
}
.term-footer .ping::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--ok);
  border-radius: 50%;
  margin-right: 8px;
  animation: ping 1.5s infinite;
  display: inline-block;
}
.term-footer .stat {
  padding-left: 1rem;
  border-left: 1px solid rgba(0,0,0,0.2);
  font-style: italic;
  opacity: 0.6;
}
.term-footer .sub {
  font-size: 8px;
  opacity: 0.4;
  margin-top: 4px;
  font-style: italic;
}

/* ============== Hero — compact variant (list / edit pages) ============== */

.page-hero.hero-compact {
  padding: 1.5rem;
  box-shadow: var(--shadow-bold);
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  justify-content: space-between;
}
@media (min-width: 1024px) { .page-hero.hero-compact { padding: 2rem; } }
.page-hero.hero-compact h1 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}
@media (min-width: 768px) { .page-hero.hero-compact h1 { font-size: 2rem; } }
.page-hero.hero-compact .hero-meta { flex: 1; min-width: 0; }
.page-hero.hero-compact .hero-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
@media (max-width: 767px) { .page-hero.hero-compact .hero-actions { width: 100%; } }
.page-hero.hero-compact .badges { margin-top: 1rem; gap: 0.5rem; }

.search-form {
  display: flex;
  gap: 0;
  border: 1px solid #000;
  background: #fff;
}
.search-form input {
  border: 0;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 13px;
  width: 220px;
  background: transparent;
}
.search-form input:focus { outline: none; box-shadow: inset 0 0 0 2px #000; }
@media (max-width: 480px) { .search-form input { width: 140px; } }
.search-form .btn-mono {
  border: 0;
  border-left: 1px solid #000;
  border-radius: 0;
  background: var(--bg);
  padding: 0 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.search-form .btn-mono:hover { background: #000; color: var(--bg); }

.btn-mono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  padding: 11px 16px;
  min-height: 44px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
}
.btn-mono:hover { background: #000; color: var(--bg); }
.btn-mono.back { gap: 6px; }

/* ============== Data Table (list view) ============== */

.data-table {
  display: grid;
  grid-template-columns: 1fr;
  border-bottom: 1px solid #000;
  background: var(--surface-soft);
}
.dt-head, .dt-row {
  display: grid;
  grid-template-columns:
    72px        /* REF */
    minmax(180px, 2.2fr)  /* NAME */
    minmax(120px, 1fr)    /* INDUSTRY */
    120px       /* STATUS */
    120px       /* AMOUNT */
    minmax(80px, 1fr)     /* OWNER */
    96px;       /* DATE */
  gap: 12px;
  padding: 12px 16px;
  align-items: center;
  border-bottom: 1px solid rgba(0,0,0,0.15);
}
.dt-head {
  background: #000;
  color: var(--bg);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid #000;
}
.dt-row {
  background: #fff;
  font-size: 13px;
  transition: background 0.1s;
}
.dt-row:hover {
  background: var(--bg-tint);
}
.dt-row:last-child { border-bottom: 0; }
.dt-row .dt-col-name strong { display: block; font-weight: 700; line-height: 1.3; }
.dt-row .dt-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.dt-row .mono-mute {
  color: var(--muted-light);
  font-size: 10px;
  letter-spacing: 0.05em;
}
.dt-row .dt-mute { color: var(--muted-light); }

@media (max-width: 1023px) {
  .dt-head { display: none; }
  .dt-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "ind  status"
      "amt  owner"
      "ref  date";
    padding: 14px 16px;
    gap: 6px 12px;
  }
  .dt-col-name { grid-area: name; }
  .dt-col-industry { grid-area: ind; font-size: 12px; color: var(--muted); }
  .dt-col-status { grid-area: status; justify-self: end; }
  .dt-col-amount { grid-area: amt; font-size: 12px; }
  .dt-col-owner { grid-area: owner; justify-self: end; font-size: 12px; color: var(--muted); }
  .dt-col-id { grid-area: ref; font-size: 10px; }
  .dt-col-date { grid-area: date; justify-self: end; font-size: 10px; color: var(--muted); }
}

/* ============== Status Transition Grid (sponsorship-detail) ============== */

.status-grid-detail {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: #000;
  padding: 1px;
  border: 1px solid #000;
}
@media (min-width: 640px) { .status-grid-detail { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .status-grid-detail { grid-template-columns: repeat(6, 1fr); } }
.pipe-trigger {
  background: #fff;
  border: none;
  padding: 14px;
  font-family: var(--mono);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 80px;
  transition: background 0.15s, color 0.15s;
}
.pipe-trigger:hover:not(:disabled) { background: #1a1a1a; color: #fff; }
.pipe-trigger:hover:not(:disabled) .pipe-label { color: rgba(255,255,255,0.6); }
.pipe-trigger:disabled, .pipe-trigger.is-current {
  background: var(--bg-tint);
  cursor: default;
  opacity: 0.95;
}
.pipe-trigger.is-current .pipe-label { color: #000; font-weight: 800; }

/* ============== Timeline (activity log) ============== */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface-soft);
}
.timeline-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  align-items: start;
}
.timeline-item:last-child { border-bottom: 0; }
.tl-marker {
  background: #1a1a1a;
  color: #fff;
  text-align: center;
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  align-self: start;
}
.tl-body { min-width: 0; }
.tl-head {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
}
.tl-head strong { font-size: 13px; }
.tl-time {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.tl-detail {
  font-size: 12px;
  color: #444;
  margin-top: 4px;
  line-height: 1.5;
}
.tl-next {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid #1a1a1a;
  padding: 3px 8px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .timeline-item { grid-template-columns: 1fr; gap: 6px; }
  .tl-marker { justify-self: start; }
}

.approach-add {
  border-top: 1px solid #000;
  background: var(--bg);
  padding: 0;
}

/* ============== Modal (reason input) ============== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal {
  background: #fff;
  border: 1px solid #000;
  box-shadow: 8px 8px 0 rgba(0,0,0,0.2);
  max-width: 480px;
  width: 100%;
}
.modal-head {
  background: #1a1a1a;
  color: #fff;
  padding: 12px 16px;
}
.modal-head h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.modal-body {
  padding: 1.25rem;
}
.modal-foot {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem;
  border-top: 1px solid rgba(0,0,0,0.15);
}

/* ============== Contact Table (key persons) ============== */

.contact-table .dt-head,
.contact-table .dt-row {
  grid-template-columns: minmax(140px,1.6fr) minmax(100px,1fr) minmax(140px,1.4fr) minmax(100px,1fr) 40px 60px;
}
@media (max-width: 1023px) {
  .contact-table .dt-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name del"
      "role role"
      "mail mail"
      "phon prim";
    gap: 6px 12px;
  }
  .contact-table .dt-row > div:nth-child(1) { grid-area: name; }
  .contact-table .dt-row > div:nth-child(2) { grid-area: role; font-size: 12px; color: var(--muted); }
  .contact-table .dt-row > div:nth-child(3) { grid-area: mail; font-size: 12px; }
  .contact-table .dt-row > div:nth-child(4) { grid-area: phon; font-size: 12px; }
  .contact-table .dt-row > div:nth-child(5) { grid-area: prim; justify-self: end; }
  .contact-table .dt-row > form { grid-area: del; justify-self: end; }
}

.badge-primary {
  display: inline-block;
  background: #1a1a1a;
  color: #fff;
  font-weight: 800;
  padding: 0 6px;
  font-size: 11px;
}

.btn-tiny {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #1a1a1a;
  padding: 10px 14px;
  min-height: 44px;
  min-width: 44px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-tiny:hover { background: #1a1a1a; color: #fff; }

.contact-add-form {
  border-top: 1px solid rgba(0,0,0,0.15);
  background: var(--bg);
}
.contact-grid {
  grid-template-columns: 1fr 1fr;
}
@media (min-width: 768px) {
  .contact-grid {
    grid-template-columns: 1.5fr 1fr 1.5fr 1fr;
  }
}
.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* ============== Audit / Staff / Edition table variants ============== */

.audit-table .dt-head, .audit-table .dt-row {
  grid-template-columns: 130px 1.4fr 1fr 90px 90px 2.6fr;
}
.audit-changes { font-family: ui-monospace, var(--mono); color: #444; word-break: break-all; }
.status-tag.audit-act-create { background: #d6f5e7; }
.status-tag.audit-act-update { background: #fde4b8; }
.status-tag.audit-act-delete { background: #ffd9e3; color: var(--alert); border-color: var(--alert); }
.status-tag.audit-act-login  { background: #e3f0fc; }
.status-tag.audit-act-logout { background: #ede5dc; }
.status-tag.audit-act-view   { background: #f4ede3; color: var(--muted); }

@media (max-width: 1023px) {
  .audit-table .dt-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "time act" "member entity" "ref ref" "ch ch";
  }
  .audit-table .dt-row > div:nth-child(1) { grid-area: time; }
  .audit-table .dt-row > div:nth-child(2) { grid-area: member; }
  .audit-table .dt-row > div:nth-child(3) { grid-area: entity; }
  .audit-table .dt-row > div:nth-child(4) { grid-area: act; justify-self: end; }
  .audit-table .dt-row > div:nth-child(5) { grid-area: ref; }
  .audit-table .dt-row > div:nth-child(6) { grid-area: ch; }
}

.staff-table .dt-head, .staff-table .dt-row {
  grid-template-columns: minmax(120px,1.4fr) minmax(140px,1.6fr) 100px 80px 130px 100px;
}
.status-tag.role-admin  { background: #fde4b8; color: #845014; }
.status-tag.role-staff  { background: #e3f0fc; color: #1f5688; }
.status-tag.role-viewer { background: #ede5dc; color: var(--muted); }

@media (max-width: 1023px) {
  .staff-table .dt-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "name role" "mail mail" "asgn last" "stat stat";
  }
  .staff-table .dt-row > div:nth-child(1) { grid-area: name; }
  .staff-table .dt-row > div:nth-child(2) { grid-area: mail; font-size: 12px; }
  .staff-table .dt-row > div:nth-child(3) { grid-area: role; justify-self: end; }
  .staff-table .dt-row > div:nth-child(4) { grid-area: asgn; font-size: 12px; }
  .staff-table .dt-row > div:nth-child(5) { grid-area: last; font-size: 10px; }
  .staff-table .dt-row > div:nth-child(6) { grid-area: stat; justify-self: end; }
}

.edition-table .dt-head, .edition-table .dt-row {
  grid-template-columns: 60px minmax(180px,2fr) 80px 100px 130px 110px 90px;
}
.edition-row { background: #fff; align-items: center; scroll-margin-top: 96px; transition: outline 0.2s, background 0.3s; }
.edition-row:target {
  background: #fff0d8;
  outline: 3px solid var(--alert);
  outline-offset: -3px;
  animation: target-pulse 1.2s ease-out 2;
}
@keyframes target-pulse {
  0% { background: #ffd9a8; }
  100% { background: #fff0d8; }
}
.edition-row select { padding: 8px 10px; font-size: 12px; }
.edition-row input[type="number"] { padding: 8px 10px; font-size: 13px; }

@media (max-width: 1023px) {
  .edition-table .dt-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "year slug" "name name" "date date" "target stat" "btn btn";
    padding: 14px;
  }
  .edition-table .dt-row > div:nth-child(1) { grid-area: year; }
  .edition-table .dt-row > div:nth-child(2) { grid-area: name; }
  .edition-table .dt-row > div:nth-child(3) { grid-area: slug; justify-self: end; }
  .edition-table .dt-row > div:nth-child(4) { grid-area: date; }
  .edition-table .dt-row > div:nth-child(5) { grid-area: target; }
  .edition-table .dt-row > div:nth-child(6) { grid-area: stat; }
  .edition-table .dt-row > div:nth-child(7) { grid-area: btn; justify-self: stretch; }
  .edition-table .dt-row > div:nth-child(7) button { width: 100%; }
}

/* ============== Status Tag (inline pill) ============== */

.status-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border: 1px solid #000;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.status-tag.status-none { color: var(--muted); border-color: var(--muted-faint); background: #fff; }
.status-tag.status-prospect { background: #f4ede3; }
.status-tag.status-requesting { background: #fff0d8; }
.status-tag.status-requested { background: #e3f0fc; }
.status-tag.status-considering { background: #ede2fc; }
.status-tag.status-committed { background: #d6f5e7; }
.status-tag.status-invoiced { background: #fde4b8; }
.status-tag.status-paid { background: #c8efd0; }
.status-tag.status-receipted { background: #ffe9a8; }
.status-tag.status-declined { background: #ffd9e3; }
.status-tag.status-on_hold { background: #fef3c7; }
.status-tag.status-cancelled { background: #ede5dc; }

/* ============== Pagination ============== */

.pagination {
  display: flex;
  gap: 0;
  border-top: 1px solid #000;
  background: var(--bg);
  flex-wrap: wrap;
}
.pg-link {
  padding: 12px 16px;
  min-height: 44px;
  min-width: 44px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-right: 1px solid #000;
  color: #000;
  background: var(--bg);
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pg-link:hover { background: #000; color: var(--bg); }
.pg-link.active { background: #000; color: var(--bg); }

/* ============== Empty State ============== */

.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  background: var(--surface-soft);
}
.empty-state.empty-state-soft { padding: 1.5rem; }
.empty-icon {
  font-size: 3rem;
  color: var(--muted-light);
  margin-bottom: 1rem;
  line-height: 1;
}
.empty-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2em;
  margin: 0 0 0.5rem;
}
.empty-sub {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 1.5rem;
}
.empty-state .btn-hero { display: inline-flex; width: auto; }

/* ============== Form (edit page) ============== */

.form-card {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
  padding: 1.25rem;
  gap: 1rem;
}
@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
    padding: 1.5rem;
    gap: 1rem 1.5rem;
  }
}
.form-row { margin-bottom: 0; }
.form-row-wide { grid-column: 1 / -1; }
.form-row-full { grid-column: 1 / -1; }
.form-row span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 6px;
  color: var(--muted);
}
.form-row span em {
  color: var(--alert);
  font-style: normal;
  margin-left: 4px;
}
.form-row textarea {
  resize: vertical;
  min-height: 100px;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
  padding: 1rem 0 2rem;
  border-top: 1px solid rgba(0,0,0,0.15);
}
@media (max-width: 640px) {
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .btn-mono, .form-actions .btn-hero { width: 100%; justify-content: center; }
}

.module-disabled { opacity: 0.55; }
.module-disabled .module-head .tag { background: var(--bg); }

/* ============== Flash (success / error) ============== */

.flash {
  padding: 14px 18px;
  border: 1px solid #000;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.flash-ok {
  background: #d6f5e7;
  border-left: 4px solid var(--ok);
}
.flash-err {
  background: rgba(239,68,68,0.08);
  border-left: 4px solid var(--alert);
  color: var(--alert);
}
.flash-err ul { margin: 0.5rem 0 0 1rem; padding: 0; }
.flash-err strong { color: var(--alert); }

/* ============== Form ============== */

form label {
  display: block;
  margin-bottom: 1rem;
}
form label span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 6px;
}
form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="tel"],
form input[type="url"],
form input[type="number"],
form input[type="date"],
form select,
form textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid #000;
  background: #fff;
  font-family: var(--mono);
  color: #000;
  transition: box-shadow 0.1s;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}

/* ============== Auth (login) ============== */

.auth-body {
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  font-family: var(--mono);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #000;
  padding: 0;
  box-shadow: var(--shadow-massive);
}
.auth-card .bar {
  background: #000;
  color: var(--bg);
  padding: 6px 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
}
.auth-card .bar .blink { animation: pulse 1.5s infinite; color: #ff4d4d; }
.auth-card .inner { padding: 2rem; }
.auth-card h1 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: #000;
}
.auth-card .sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1.5rem;
}
.auth-card .hint {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  margin-top: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.auth-card button {
  width: 100%;
  background: #000;
  color: var(--bg);
  border: 2px solid #000;
  padding: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  transition: background 0.15s, color 0.15s;
}
.auth-card button:hover {
  background: var(--bg);
  color: #000;
}
.auth-card .error {
  background: rgba(239,68,68,0.08);
  border-left: 3px solid var(--alert);
  color: var(--alert);
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}
