/* Pintu Design System — Bug Bounty Portal
   Dark-mode first, adapted from Pintu mobile DS for web */

/* ─── Design Tokens ─────────────────────────────────────── */
:root {
  /* Canvas */
  --canvas-primary:    #181818;
  --canvas-secondary:  #252525;
  --canvas-tertiary:   #2e2e2e;
  --canvas-border:     #3A3A3A;
  --canvas-border-sub: #2a2a2a;

  /* Ink */
  --ink-primary:   #FFFFFF;
  --ink-secondary: #C7C7C7;
  --ink-tertiary:  #ABABAB;
  --ink-disabled:  #5a5a5a;

  /* Product */
  --product-primary: #1A7FF9;
  --product-hover:   #0A50E2;
  --product-muted:   rgba(26,127,249,.15);
  --product-border:  rgba(26,127,249,.35);

  /* Semantic */
  --success:        #1CCB21;
  --success-muted:  rgba(28,203,33,.14);
  --danger:         #FF5A5A;
  --danger-muted:   rgba(255,90,90,.14);
  --danger-hover:   #e04040;
  --warning:        #FFA009;
  --warning-muted:  rgba(255,160,9,.14);
  --info:           #1A7FF9;
  --info-muted:     rgba(26,127,249,.14);

  /* Severity */
  --sev-critical: #FF5A5A;
  --sev-high:     #FFA009;
  --sev-medium:   #F7CE46;
  --sev-low:      #1CCB21;
  --sev-info:     #1A7FF9;

  /* Elevation */
  --shadow-sm:  0 0 1px rgba(0,0,0,.04), 0 0 4px rgba(0,0,0,.16);
  --shadow-md:  0 0 1px rgba(0,0,0,.06), 0 2px 12px rgba(0,0,0,.28);
  --shadow-lg:  0 0 1px rgba(0,0,0,.08), 0 4px 24px rgba(0,0,0,.40);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing scale */
  --s1: .25rem;  /* 4px  */
  --s2: .5rem;   /* 8px  */
  --s3: .75rem;  /* 12px */
  --s4: 1rem;    /* 16px */
  --s5: 1.25rem; /* 20px */
  --s6: 1.5rem;  /* 24px */
  --s8: 2rem;    /* 32px */

  /* Radius */
  --r1: 4px;
  --r2: 8px;
  --r3: 12px;
  --r4: 16px;
  --r-full: 9999px;

  /* Transitions */
  --t-fast: 120ms ease;
  --t-base: 200ms ease;
}

/* ─── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--canvas-primary);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: .9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--product-primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--product-hover); }

img, svg { display: block; }

:focus-visible {
  outline: 2px solid var(--product-primary);
  outline-offset: 2px;
  border-radius: var(--r1);
}

/* ─── Typography ─────────────────────────────────────────── */
h1 { font-size: 1.625rem; font-weight: 700; line-height: 1.25; }
h2 { font-size: 1.375rem; font-weight: 700; line-height: 1.3;  }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.35; }
h4 { font-size: 1rem;     font-weight: 600; line-height: 1.4;  }

.text-sm  { font-size: .8125rem; }
.text-xs  { font-size: .75rem;   }
.text-sec { color: var(--ink-secondary); }
.text-ter { color: var(--ink-tertiary);  }
.text-dis { color: var(--ink-disabled);  }
.text-prod { color: var(--product-primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger);  }
.text-warning { color: var(--warning); }

code, pre {
  font-family: var(--font-mono);
  font-size: .875rem;
}

pre {
  background: var(--canvas-secondary);
  border: 1px solid var(--canvas-border);
  border-radius: var(--r2);
  padding: var(--s4);
  overflow-x: auto;
}

/* ─── Layout Helpers ─────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--s6);
}

.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: var(--s1); }
.gap-2 { gap: var(--s2); }
.gap-3 { gap: var(--s3); }
.gap-4 { gap: var(--s4); }
.gap-6 { gap: var(--s6); }
.flex-1  { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2,1fr); }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-4 { grid-template-columns: repeat(4,1fr); }

.w-full  { width: 100%; }
.h-full  { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Margin/Padding helpers */
.mt-1 { margin-top: var(--s1); }
.mt-2 { margin-top: var(--s2); }
.mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); }
.mt-6 { margin-top: var(--s6); }
.mt-8 { margin-top: var(--s8); }
.mb-2 { margin-bottom: var(--s2); }
.mb-4 { margin-bottom: var(--s4); }
.mb-6 { margin-bottom: var(--s6); }

.p-2 { padding: var(--s2); }
.p-3 { padding: var(--s3); }
.p-4 { padding: var(--s4); }
.p-6 { padding: var(--s6); }
.px-3 { padding-left: var(--s3); padding-right: var(--s3); }
.px-4 { padding-left: var(--s4); padding-right: var(--s4); }
.px-6 { padding-left: var(--s6); padding-right: var(--s6); }
.py-2 { padding-top: var(--s2); padding-bottom: var(--s2); }
.py-3 { padding-top: var(--s3); padding-bottom: var(--s3); }

/* ─── Card ───────────────────────────────────────────────── */
.card {
  background: var(--canvas-secondary);
  border: 1px solid var(--canvas-border);
  border-radius: var(--r3);
  box-shadow: var(--shadow-sm);
}

.card-body { padding: var(--s6); }

.card-header {
  padding: var(--s4) var(--s6);
  border-bottom: 1px solid var(--canvas-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Button ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  font-family: var(--font-sans);
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1;
  padding: .625rem 1.125rem;
  border-radius: var(--r2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), opacity var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}

.btn:disabled, .btn[aria-busy="true"] {
  opacity: .45;
  cursor: not-allowed;
}

/* Primary */
.btn-primary {
  background: var(--product-primary);
  color: #fff;
  border-color: var(--product-primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--product-hover);
  border-color: var(--product-hover);
  color: #fff;
}

/* Secondary / Ghost */
.btn-secondary {
  background: transparent;
  color: var(--ink-primary);
  border-color: var(--canvas-border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--canvas-tertiary);
  border-color: var(--canvas-border);
}

/* Danger */
.btn-danger {
  background: var(--danger-muted);
  color: var(--danger);
  border-color: rgba(255,90,90,.3);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}

/* Success */
.btn-success {
  background: var(--success-muted);
  color: var(--success);
  border-color: rgba(28,203,33,.3);
}
.btn-success:hover:not(:disabled) {
  background: var(--success);
  color: #fff;
}

/* Warning */
.btn-warning {
  background: var(--warning-muted);
  color: var(--warning);
  border-color: rgba(255,160,9,.3);
}
.btn-warning:hover:not(:disabled) {
  background: var(--warning);
  color: #fff;
}

/* Ghost (link-style) */
.btn-ghost {
  background: transparent;
  color: var(--ink-secondary);
  border-color: transparent;
  padding-left: var(--s2);
  padding-right: var(--s2);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--canvas-tertiary);
  color: var(--ink-primary);
}

/* Sizes */
.btn-sm { font-size: .8125rem; padding: .375rem .75rem; }
.btn-lg { font-size: 1.0625rem; padding: .75rem 1.5rem; }
.btn-icon { padding: .625rem; border-radius: var(--r2); }

/* HTMX loading state */
.btn[aria-busy="true"]::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-left: var(--s2);
}

/* ─── Input / Form ───────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.form-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink-secondary);
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.input-field {
  background: var(--canvas-primary);
  border: 1px solid var(--canvas-border);
  border-radius: var(--r2);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: .9375rem;
  padding: .625rem .875rem;
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}

.input-field::placeholder { color: var(--ink-disabled); }

.input-field:focus {
  border-color: var(--product-primary);
  box-shadow: 0 0 0 3px var(--product-muted);
}

.input-field:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.input-field.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-muted);
}

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

select.input-field { cursor: pointer; }

.form-hint {
  font-size: .8125rem;
  color: var(--ink-tertiary);
}

.form-error {
  font-size: .8125rem;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: var(--s1);
}

/* ─── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: var(--r-full);
  line-height: 1.4;
  white-space: nowrap;
}

/* Status */
.badge-new       { background: var(--product-muted);  color: var(--product-primary); border: 1px solid var(--product-border); }
.badge-triaging  { background: var(--warning-muted);  color: var(--warning); border: 1px solid rgba(255,160,9,.3); }
.badge-accepted  { background: var(--success-muted);  color: var(--success); border: 1px solid rgba(28,203,33,.3); }
.badge-resolved  { background: rgba(28,203,33,.08);   color: #0d9910; border: 1px solid rgba(28,203,33,.2); }
.badge-duplicate { background: var(--canvas-tertiary); color: var(--ink-tertiary); border: 1px solid var(--canvas-border); }
.badge-invalid   { background: var(--danger-muted);   color: var(--danger); border: 1px solid rgba(255,90,90,.3); }
.badge-informative { background: var(--canvas-tertiary); color: var(--ink-tertiary); border: 1px solid var(--canvas-border); }

/* Severity */
.badge-critical { background: rgba(255,90,90,.14);   color: var(--sev-critical); border: 1px solid rgba(255,90,90,.3);  }
.badge-high     { background: rgba(255,160,9,.14);   color: var(--sev-high);     border: 1px solid rgba(255,160,9,.3);  }
.badge-medium   { background: rgba(247,206,70,.14);  color: var(--sev-medium);   border: 1px solid rgba(247,206,70,.3); }
.badge-low      { background: rgba(28,203,33,.14);   color: var(--sev-low);      border: 1px solid rgba(28,203,33,.3);  }
.badge-info-sev { background: var(--product-muted);  color: var(--sev-info);     border: 1px solid var(--product-border); }

/* Generic */
.badge-success  { background: var(--success-muted); color: var(--success); }
.badge-danger   { background: var(--danger-muted);  color: var(--danger);  }
.badge-warning  { background: var(--warning-muted); color: var(--warning); }
.badge-default  { background: var(--canvas-tertiary); color: var(--ink-secondary); }

/* ─── Navigation ─────────────────────────────────────────── */
/* Top Nav (Researcher Portal) */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(24,24,24,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--canvas-border);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 var(--s6);
}

.topnav__brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.topnav__links {
  display: flex;
  align-items: center;
  gap: var(--s1);
  margin-left: auto;
}

.topnav__link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--ink-secondary);
  font-size: .9375rem;
  padding: .375rem .75rem;
  border-radius: var(--r2);
  transition: background var(--t-fast), color var(--t-fast);
}

.topnav__link:hover { background: var(--canvas-tertiary); color: var(--ink-primary); }
.topnav__link.active { color: var(--ink-primary); background: var(--canvas-tertiary); }

/* Side Nav (Admin Portal) */
.sidenav {
  width: 240px;
  min-height: 100vh;
  background: var(--canvas-secondary);
  border-right: 1px solid var(--canvas-border);
  display: flex;
  flex-direction: column;
  padding: var(--s4) 0;
  flex-shrink: 0;
}

.sidenav__brand {
  padding: var(--s2) var(--s4) var(--s6);
  font-weight: 700;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.sidenav__section {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
  padding: var(--s4) var(--s4) var(--s2);
}

.sidenav__item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: .5625rem var(--s4);
  color: var(--ink-secondary);
  font-size: .9375rem;
  border-radius: 0;
  transition: background var(--t-fast), color var(--t-fast);
  cursor: pointer;
  text-decoration: none;
}

.sidenav__item:hover { background: var(--canvas-tertiary); color: var(--ink-primary); }

.sidenav__item.active {
  background: var(--product-muted);
  color: var(--product-primary);
}

.sidenav__item .badge {
  margin-left: auto;
  font-size: .6875rem;
}

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--canvas-border);
  gap: 0;
}

.tab {
  padding: .75rem 1.125rem;
  font-size: .9375rem;
  font-weight: 500;
  color: var(--ink-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-sans);
}

.tab:hover { color: var(--ink-secondary); }

.tab.active {
  color: var(--ink-primary);
  border-bottom-color: var(--product-primary);
}

/* ─── Table ──────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

thead th {
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
  padding: .625rem var(--s4);
  border-bottom: 1px solid var(--canvas-border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--canvas-border-sub);
  transition: background var(--t-fast);
}

tbody tr:hover { background: var(--canvas-tertiary); }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: .875rem var(--s4);
  vertical-align: middle;
}

/* ─── Alert / Callout ────────────────────────────────────── */
.alert {
  padding: var(--s3) var(--s4);
  border-radius: var(--r2);
  border: 1px solid;
  font-size: .9375rem;
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  line-height: 1.5;
}

.alert-danger  { background: var(--danger-muted);  border-color: rgba(255,90,90,.3);  color: var(--danger);  }
.alert-warning { background: var(--warning-muted); border-color: rgba(255,160,9,.3);  color: var(--warning); }
.alert-success { background: var(--success-muted); border-color: rgba(28,203,33,.3);  color: var(--success); }
.alert-info    { background: var(--product-muted); border-color: var(--product-border); color: var(--product-primary); }

/* ─── Toast ──────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  pointer-events: none;
}

.toast {
  background: var(--canvas-secondary);
  border: 1px solid var(--canvas-border);
  border-radius: var(--r3);
  box-shadow: var(--shadow-lg);
  padding: .875rem var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: .9375rem;
  min-width: 280px;
  max-width: 400px;
  pointer-events: all;
  animation: toast-in .25s ease;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger);  }
.toast-info    { border-left: 3px solid var(--product-primary); }
.toast-warning { border-left: 3px solid var(--warning); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(1rem); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Severity Selector ──────────────────────────────────── */
.severity-selector {
  display: flex;
  gap: var(--s2);
}

.severity-btn {
  flex: 1;
  padding: .5rem .25rem;
  border-radius: var(--r2);
  border: 1px solid var(--canvas-border);
  background: transparent;
  color: var(--ink-tertiary);
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--t-fast);
  font-family: var(--font-sans);
}

.severity-btn[data-sev="critical"].selected { background: rgba(255,90,90,.14);  color: var(--sev-critical); border-color: rgba(255,90,90,.4);  }
.severity-btn[data-sev="high"].selected     { background: rgba(255,160,9,.14);  color: var(--sev-high);     border-color: rgba(255,160,9,.4);  }
.severity-btn[data-sev="medium"].selected   { background: rgba(247,206,70,.14); color: var(--sev-medium);   border-color: rgba(247,206,70,.4); }
.severity-btn[data-sev="low"].selected      { background: rgba(28,203,33,.14);  color: var(--sev-low);      border-color: rgba(28,203,33,.4);  }
.severity-btn[data-sev="info"].selected     { background: var(--product-muted); color: var(--sev-info);     border-color: var(--product-border); }

.severity-btn:hover { border-color: var(--canvas-border); background: var(--canvas-tertiary); }

/* ─── Markdown Editor ────────────────────────────────────── */
.md-editor {
  border: 1px solid var(--canvas-border);
  border-radius: var(--r2);
  overflow: hidden;
}

.md-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s1);
  padding: var(--s2) var(--s3);
  background: var(--canvas-tertiary);
  border-bottom: 1px solid var(--canvas-border);
}

.md-toolbar-btn {
  background: transparent;
  border: none;
  color: var(--ink-tertiary);
  padding: .25rem .375rem;
  border-radius: var(--r1);
  cursor: pointer;
  font-size: .875rem;
  font-family: var(--font-mono);
  transition: background var(--t-fast), color var(--t-fast);
}

.md-toolbar-btn:hover { background: var(--canvas-secondary); color: var(--ink-primary); }
.md-toolbar-divider { width: 1px; height: 1rem; background: var(--canvas-border); margin: 0 var(--s1); }

.md-tabs { display: flex; }
.md-tab-btn {
  font-size: .8125rem;
  font-weight: 500;
  padding: .25rem .75rem;
  border: none;
  background: transparent;
  color: var(--ink-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: var(--font-sans);
  transition: color var(--t-fast), border-color var(--t-fast);
}
.md-tab-btn.active { color: var(--ink-primary); border-bottom-color: var(--product-primary); }

.md-editor textarea {
  width: 100%;
  background: var(--canvas-primary);
  border: none;
  border-radius: 0;
  padding: var(--s4);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: .875rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 160px;
}
.md-editor textarea:focus { outline: none; }

.md-preview {
  padding: var(--s4);
  background: var(--canvas-primary);
  min-height: 160px;
  font-size: .9375rem;
  line-height: 1.7;
}

.md-preview h1,h2,h3,h4 { margin: 1rem 0 .5rem; }
.md-preview p   { margin-bottom: .75rem; }
.md-preview ul, .md-preview ol { margin: .5rem 0 .5rem 1.5rem; }
.md-preview code { background: var(--canvas-secondary); padding: .1em .35em; border-radius: var(--r1); }

/* ─── Attachment Zone ────────────────────────────────────── */
.attach-zone {
  display: block; /* <label> is inline by default; block required for correct border rendering */
  border: 2px dashed var(--canvas-border);
  border-radius: var(--r3);
  padding: var(--s8) var(--s6);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-base), background var(--t-base);
}

.attach-zone:hover, .attach-zone.dragover {
  border-color: var(--product-primary);
  background: var(--product-muted);
}

.attach-zone__icon { font-size: 2rem; margin-bottom: var(--s2); opacity: .5; }
.attach-zone__label { color: var(--ink-secondary); font-size: .9375rem; }
.attach-zone__hint  { color: var(--ink-tertiary);  font-size: .8125rem; margin-top: var(--s1); }

.attach-list { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  background: var(--canvas-tertiary);
  border: 1px solid var(--canvas-border);
  border-radius: var(--r-full);
  padding: .25rem .75rem;
  font-size: .8125rem;
  color: var(--ink-secondary);
}

.attach-chip__remove {
  background: none;
  border: none;
  color: var(--ink-tertiary);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  transition: color var(--t-fast);
}
.attach-chip__remove:hover { color: var(--danger); }

/* ─── Attachment Previews ────────────────────────────────── */
.attach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s3);
}

.attach-thumbnail {
  border: 1px solid var(--canvas-border);
  border-radius: var(--r2);
  overflow: hidden;
}

.attach-thumbnail img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.attach-thumbnail .attach-filename,
.attach-video .attach-filename {
  padding: var(--s2);
  font-size: .8125rem;
  color: var(--ink-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attach-video {
  border: 1px solid var(--canvas-border);
  border-radius: var(--r2);
  overflow: hidden;
}

.attach-video video {
  width: 100%;
  display: block;
}

.attach-file-link {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3);
  border: 1px solid var(--canvas-border);
  border-radius: var(--r2);
  color: var(--ink-secondary);
  font-size: .9375rem;
  text-decoration: none;
  transition: border-color var(--t-fast), color var(--t-fast);
}

.attach-file-link:hover {
  border-color: var(--product-primary);
  color: var(--product-primary);
}

/* ─── Status Timeline ────────────────────────────────────── */
.status-timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: flex;
  gap: var(--s4);
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: -8px;
  width: 2px;
  background: var(--canvas-border);
}

.timeline-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--canvas-border);
  background: var(--canvas-secondary);
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-dot.active  { border-color: var(--product-primary); background: var(--product-muted); }
.timeline-dot.done    { border-color: var(--success); background: var(--success-muted); }
.timeline-dot.danger  { border-color: var(--danger); background: var(--danger-muted); }

.timeline-body { padding-bottom: var(--s6); }
.timeline-label { font-weight: 600; font-size: .9375rem; }
.timeline-meta  { font-size: .8125rem; color: var(--ink-tertiary); margin-top: 2px; }

/* ─── Comment Thread ─────────────────────────────────────── */
.comment-thread { display: flex; flex-direction: column; gap: var(--s4); }

.comment {
  display: flex;
  gap: var(--s3);
}

.comment__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--canvas-tertiary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .875rem;
  color: var(--ink-secondary);
}

.comment__body { flex: 1; }
.comment__header { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s2); }
.comment__name   { font-weight: 600; font-size: .9375rem; }
.comment__time   { font-size: .8125rem; color: var(--ink-tertiary); }
.comment__bubble {
  background: var(--canvas-tertiary);
  border: 1px solid var(--canvas-border);
  border-radius: 0 var(--r2) var(--r2) var(--r2);
  padding: var(--s3) var(--s4);
  font-size: .9375rem;
  line-height: 1.6;
}

.comment--admin .comment__bubble {
  background: var(--product-muted);
  border-color: var(--product-border);
}

.comment--system .comment__bubble {
  background: transparent;
  border: none;
  color: var(--ink-tertiary);
  font-size: .8125rem;
  font-style: italic;
  padding-left: 0;
}

/* ─── Stat Card ──────────────────────────────────────────── */
.stat-card {
  background: var(--canvas-secondary);
  border: 1px solid var(--canvas-border);
  border-radius: var(--r3);
  padding: var(--s5) var(--s6);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.stat-card__label { font-size: .8125rem; font-weight: 500; color: var(--ink-tertiary); }
.stat-card__value { font-size: 1.875rem; font-weight: 700; line-height: 1; }
.stat-card__delta { font-size: .8125rem; color: var(--ink-tertiary); }

/* ─── Progress / Step Indicator ─────────────────────────── */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
}

.step-item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink-tertiary);
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--canvas-border);
  background: var(--canvas-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8125rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--t-base);
}

.step-item.active .step-dot {
  background: var(--product-primary);
  border-color: var(--product-primary);
  color: #fff;
}
.step-item.active { color: var(--ink-primary); }
.step-item.done .step-dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.step-item.done { color: var(--ink-secondary); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--canvas-border);
  min-width: 24px;
}

/* ─── Filter Chips ───────────────────────────────────────── */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.filter-chip {
  padding: .375rem .875rem;
  border-radius: var(--r-full);
  border: 1px solid var(--canvas-border);
  background: transparent;
  color: var(--ink-secondary);
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: var(--font-sans);
}

.filter-chip:hover { border-color: var(--product-primary); color: var(--product-primary); }

.filter-chip.active {
  background: var(--product-muted);
  border-color: var(--product-border);
  color: var(--product-primary);
}

/* ─── OTP Input ──────────────────────────────────────────── */
.otp-inputs {
  display: flex;
  gap: var(--s3);
  justify-content: center;
}

.otp-input {
  width: 52px;
  height: 60px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .05em;
  background: var(--canvas-primary);
  border: 2px solid var(--canvas-border);
  border-radius: var(--r2);
  color: var(--ink-primary);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.otp-input:focus {
  border-color: var(--product-primary);
  box-shadow: 0 0 0 3px var(--product-muted);
}

/* ─── Password Strength ──────────────────────────────────── */
.pw-strength { display: flex; gap: var(--s1); height: 4px; }
.pw-bar {
  flex: 1;
  border-radius: var(--r-full);
  background: var(--canvas-border);
  transition: background var(--t-base);
}
.pw-bar.filled[data-strength="1"] { background: var(--danger);  }
.pw-bar.filled[data-strength="2"] { background: var(--warning); }
.pw-bar.filled[data-strength="3"] { background: #F7CE46;        }
.pw-bar.filled[data-strength="4"] { background: var(--success); }

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r2);
  border: 1px solid var(--canvas-border);
  background: transparent;
  color: var(--ink-secondary);
  font-size: .875rem;
  cursor: pointer;
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
}
.page-btn:hover { background: var(--canvas-tertiary); color: var(--ink-primary); }
.page-btn.active {
  background: var(--product-primary);
  border-color: var(--product-primary);
  color: #fff;
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── AI Analysis Card ───────────────────────────────────── */
.ai-card {
  background: linear-gradient(135deg, rgba(26,127,249,.08) 0%, rgba(26,127,249,.03) 100%);
  border: 1px solid var(--product-border);
  border-radius: var(--r3);
  padding: var(--s6);
}

.ai-verdict {
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.ai-dimension {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--canvas-border);
}
.ai-dimension:last-child { border-bottom: none; }

/* ─── Rate Gauge ─────────────────────────────────────────── */
.rate-gauge { display: flex; flex-direction: column; gap: var(--s2); }
.rate-bar-bg {
  background: var(--canvas-border);
  border-radius: var(--r-full);
  height: 6px;
  overflow: hidden;
}
.rate-bar-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--product-primary);
  transition: width var(--t-base);
}
.rate-bar-fill.warn { background: var(--warning); }
.rate-bar-fill.crit { background: var(--danger); }

/* ─── HTMX Indicators ────────────────────────────────────── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.htmx-indicator { display: inline-flex; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  opacity: .7;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Divider ────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--canvas-border);
  margin: var(--s4) 0;
}

/* ─── Chip / Tag ─────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  background: var(--canvas-tertiary);
  border: 1px solid var(--canvas-border);
  border-radius: var(--r-full);
  padding: .2rem .625rem;
  font-size: .8125rem;
  color: var(--ink-secondary);
}

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s8);
  gap: var(--s4);
  text-align: center;
  color: var(--ink-tertiary);
}

.empty-state__icon { font-size: 2.5rem; opacity: .4; }
.empty-state__title { font-size: 1rem; font-weight: 600; color: var(--ink-secondary); }
.empty-state__desc  { font-size: .9375rem; max-width: 320px; }

/* ─── Misc Utilities ─────────────────────────────────────── */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only  { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.rounded  { border-radius: var(--r2); }
.rounded-full { border-radius: var(--r-full); }
.shadow   { box-shadow: var(--shadow-sm); }

/* Separator dot */
.sep { color: var(--ink-tertiary); margin: 0 var(--s2); font-size: .75rem; }

/* Internal note label */
.note-internal {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--warning);
  background: var(--warning-muted);
  border-radius: var(--r1);
  padding: .1rem .4rem;
}

/* ─── Policy document body ───────────────────────────────── */
.policy-body { color: var(--ink-secondary); line-height: 1.75; }
.policy-body p { margin-bottom: 1rem; }
.policy-body h2 { font-size: 1.25rem; font-weight: 700; color: var(--ink-primary); margin-top: 2rem; margin-bottom: .75rem; }
.policy-body h3 { font-size: 1rem; font-weight: 600; color: var(--ink-primary); margin-top: 1.5rem; margin-bottom: .5rem; }
.policy-body ul, .policy-body ol { padding-left: 1.5rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.policy-body ul { list-style: disc; }
.policy-body ol { list-style: decimal; }
.policy-body li { color: var(--ink-secondary); }
.policy-body a { color: var(--product-primary); text-decoration: underline; }
.policy-body strong { color: var(--ink-primary); font-weight: 600; }
.policy-body table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: .9rem; }
.policy-body th { text-align: left; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-tertiary); padding: .5rem .75rem; border-bottom: 1px solid var(--canvas-border); }
.policy-body td { padding: .65rem .75rem; border-bottom: 1px solid var(--canvas-border); color: var(--ink-secondary); }
.policy-body tr:last-child td { border-bottom: none; }
