:root {
  --ink: #070d16;
  --panel: #0f172a;
  --panel-2: #111f36;
  --elevated: #152238;
  --border: #1e3a5f;
  --border-light: #2d4a6f;
  --text: #e8eef7;
  --muted: #8fa3bf;
  --accent: #c9a962;
  --accent-dim: rgba(201, 169, 98, 0.12);
  --success: #3d9a6e;
  --warning: #d4a017;
  --danger: #c94c5c;
  --prospect: #5b8def;
  --font-ui: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  --radius: 10px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

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

html {
  font-size: 15px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--ink);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(30, 58, 95, 0.45), transparent),
    linear-gradient(180deg, var(--ink), #0a1220);
}

a {
  color: var(--accent);
}

.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  box-sizing: border-box;
}

.brand-mark-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(1.65rem, 2.8vw + 1rem, 2.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-text p {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-pill {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.stat-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-value {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 600;
}

.stat-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.layout-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .layout-main {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.field-inline span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.input,
.select {
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--elevated);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  min-width: 140px;
}

.input:focus,
.select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--panel-2);
  white-space: nowrap;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: rgba(201, 169, 98, 0.06);
}

.data-table tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.company-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.company-name-text {
  min-width: 0;
}

.company-logo-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(201, 169, 98, 0.25));
}

.company-logo-icon svg {
  display: block;
  vertical-align: middle;
}

.register-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translate3d(-50%, 120%, 0);
  z-index: 100;
  padding: 0.65rem 1.35rem;
  background: var(--elevated);
  border: 1px solid rgba(61, 154, 110, 0.45);
  color: var(--text);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transition: transform 0.28s ease, opacity 0.28s ease;
  opacity: 0;
  pointer-events: none;
  max-width: min(92vw, 400px);
  text-align: center;
  font-size: 0.88rem;
}

.register-toast.register-toast--visible {
  transform: translate3d(-50%, 0, 0);
  opacity: 1;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge-active {
  background: rgba(61, 154, 110, 0.15);
  color: #7dcea0;
  border-color: rgba(61, 154, 110, 0.35);
}

.badge-expiring {
  background: rgba(212, 160, 23, 0.12);
  color: #f0c75e;
  border-color: rgba(212, 160, 23, 0.35);
}

.badge-ended {
  background: rgba(201, 76, 92, 0.12);
  color: #f5a5af;
  border-color: rgba(201, 76, 92, 0.3);
}

.badge-prospect {
  background: rgba(91, 141, 239, 0.12);
  color: #9bbcf7;
  border-color: rgba(91, 141, 239, 0.35);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot-active {
  background: var(--success);
}
.dot-expiring {
  background: var(--warning);
}
.dot-ended {
  background: var(--danger);
}
.dot-prospect {
  background: var(--prospect);
}

.side-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.reminder-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
}

.reminder-list li {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}

.reminder-list li:last-child {
  border-bottom: none;
}

.reminder-company {
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.reminder-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.chart-box {
  padding: 0.75rem 1rem 1rem;
  min-height: 220px;
}

.chart-box canvas {
  max-height: 200px;
}

.chart-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
  padding: 0 0.15rem;
}

.revenue-season-detail {
  margin-top: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.revenue-season-detail__title {
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.revenue-season-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}

.revenue-season-detail-list li {
  padding: 0.5rem 0.6rem;
  margin-bottom: 2px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.84rem;
}

.revenue-season-detail-list li:hover,
.revenue-season-detail-list li:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.06);
}

.revenue-season-company {
  font-weight: 600;
  margin-bottom: 0.12rem;
}

.revenue-season-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-season-empty {
  margin: 0.25rem 0 0;
  padding: 0;
  font-size: 0.82rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.btn-primary {
  background: linear-gradient(180deg, #d4b978, #b8923c);
  color: #1a1204;
  border-color: #a67c2a;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-light);
}

.btn-ghost:hover {
  background: var(--accent-dim);
}

.btn-danger {
  background: transparent;
  color: #f5a5af;
  border-color: rgba(201, 76, 92, 0.45);
}

.btn-danger:hover {
  background: rgba(201, 76, 92, 0.12);
}

.btn-block {
  width: 100%;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 100%);
  height: 100%;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.drawer-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.drawer-body {
  padding: 1rem 1.1rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.detail-grid {
  display: grid;
  gap: 1rem;
}

.detail-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.detail-section p,
.detail-section dl {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}

.dl-rows dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0.65rem;
}

.dl-rows dt:first-child {
  margin-top: 0;
}

.dl-rows dd {
  margin: 0.15rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.field-input,
.field textarea,
.field select {
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--elevated);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.expect-fieldset {
  margin: 0;
  padding: 0.85rem 0 0;
  border: none;
  border-top: 1px solid var(--border);
}

.expect-fieldset legend {
  padding: 0;
  margin: 0 0 0.25rem;
}

.expect-fieldset-hint {
  margin: 0 0 0.65rem !important;
}

.expect-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.88rem;
}

.expect-grid-head,
.expect-grid-row {
  display: grid;
  grid-template-columns: 1fr 5.5rem 5.5rem;
  gap: 0.35rem 0.75rem;
  align-items: center;
}

.expect-grid-head {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.expect-grid-head span:nth-child(2),
.expect-grid-head span:nth-child(3) {
  text-align: center;
}

.expect-item-label {
  color: var(--text);
}

.expect-cb-label {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

.expect-cb-label input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.expect-cb-label input:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.expect-notes-field {
  margin-top: 0.85rem;
}

.expect-view-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.6;
}

.expect-view-notes {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
}

.expect-view-notes-title {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.expect-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 0.15rem;
}

.expect-tag-done {
  background: rgba(61, 154, 110, 0.2);
  color: #7dcea0;
}

.expect-tag-open {
  background: rgba(212, 160, 23, 0.15);
  color: #f0c75e;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.form-error {
  color: #f5a5af;
  font-size: 0.85rem;
  margin: 0.25rem 0 0;
}

.panel-inline-error {
  margin: 0;
  padding: 0.65rem 1.1rem 0;
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-wrap {
  width: min(420px, 100%);
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.auth-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #8b6914);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.auth-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.auth-title {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.auth-lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-form .field {
  margin-bottom: 0.85rem;
}

.auth-foot {
  margin: 1.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tips-panel {
  margin-bottom: 1.5rem;
}

.tip-badge-new {
  background: rgba(91, 141, 239, 0.15);
  color: #9bbcf7;
  border-color: rgba(91, 141, 239, 0.35);
}

.tip-badge-review {
  background: rgba(212, 160, 23, 0.12);
  color: #f0c75e;
  border-color: rgba(212, 160, 23, 0.35);
}

.tip-badge-converted {
  background: rgba(61, 154, 110, 0.15);
  color: #7dcea0;
  border-color: rgba(61, 154, 110, 0.35);
}

.tip-badge-dismissed {
  background: rgba(143, 163, 179, 0.12);
  color: var(--muted);
  border-color: var(--border-light);
}

.auth-links {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.auth-links a {
  font-size: 0.88rem;
  font-weight: 500;
}

.public-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.public-back {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
}

.public-back:hover {
  color: var(--accent);
}

.public-card h1 {
  margin: 0 0 0.5rem;
  font-size: 2.05rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.public-lede {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

.file-upload-block {
  margin-top: 0.5rem;
}

.file-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.upload-kind-select {
  min-width: 11rem;
}

.file-input-native {
  max-width: 14rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
}

.btn-tiny {
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
}

.file-empty {
  margin: 0 0 0.5rem;
}

.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.logo-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  background: var(--elevated);
}

.logo-thumb-wrap {
  display: block;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.logo-thumb {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100px;
  object-fit: contain;
  background: var(--panel-2);
}

.logo-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
}

.logo-meta strong {
  font-size: 0.8rem;
  word-break: break-word;
}

.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}

.doc-row:last-child {
  border-bottom: none;
}

.doc-name {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  flex: 1;
  min-width: 8rem;
  word-break: break-word;
}

.doc-name:hover {
  text-decoration: underline;
}

.doc-meta {
  color: var(--muted);
  font-size: 0.8rem;
}
