:root {
  --bg: #eef3f1;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #f3f8f7;
  --panel-muted: #f7faf9;
  --line: rgba(115, 134, 128, 0.18);
  --line-strong: rgba(70, 94, 86, 0.28);
  --text: #182425;
  --muted: #5d6c69;
  --accent: #174f57;
  --accent-strong: #0f3f45;
  --accent-soft: #dff1ef;
  --danger: #b34040;
  --danger-soft: #fff1f0;
  --warning: #a46315;
  --warning-soft: #fff7e7;
  --success: #21795d;
  --success-soft: #edf8f2;
  --shadow: 0 18px 44px rgba(24, 36, 37, 0.08);
  --shadow-soft: 0 10px 24px rgba(24, 36, 37, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI Variable", "Segoe UI", "IBM Plex Sans", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(23, 79, 87, 0.09), transparent 28%),
    radial-gradient(circle at 100% 0, rgba(72, 122, 104, 0.08), transparent 24%),
    linear-gradient(180deg, #f9fcfb 0%, #eef3f1 100%);
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

.runtime-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  padding: 10px 14px;
  font-size: 0.9rem;
  text-align: center;
  color: #fff;
  background: linear-gradient(90deg, #8a580e 0%, #9f6a1a 100%);
}

.runtime-banner[data-tone="ok"] {
  background: linear-gradient(90deg, #1d6f58 0%, #2f8f73 100%);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.section-shell {
  padding: 22px;
}

.critical-surface {
  border-color: color-mix(in srgb, rgba(23, 79, 87, 0.34) 68%, var(--line));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(241, 248, 246, 0.93)),
    var(--panel);
}

.critical-surface h2 {
  letter-spacing: -0.01em;
}

.critical-surface .eyebrow {
  color: color-mix(in srgb, var(--muted) 84%, var(--text));
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-layout {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(380px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.login-stack {
  display: grid;
  gap: 18px;
}

.login-hero-panel {
  padding: 34px;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(23, 79, 87, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 247, 246, 0.94));
}

.login-hero-panel h1 {
  margin: 12px 0 16px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.08;
}

.hero-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.hero-list-item {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.login-panel {
  padding: 36px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 251, 0.96)),
    var(--panel);
}

.login-support-panel {
  padding: 24px;
}

.login-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.password-strength-shell {
  display: grid;
  gap: 8px;
}

.password-strength-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(23, 79, 87, 0.12);
  overflow: hidden;
}

.password-strength-bar span {
  display: block;
  height: 100%;
  width: 30%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c15a38 0%, #c38d1a 48%, #1f8a6b 100%);
  transition: width 0.16s ease;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}

label span {
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: rgba(23, 79, 87, 0.4);
  box-shadow: 0 0 0 4px rgba(23, 79, 87, 0.12);
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
  box-shadow: var(--shadow-soft);
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 63, 69, 0.16);
}

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

button.secondary {
  background: linear-gradient(180deg, #eef4f3 0%, #dfe8e6 100%);
  color: var(--text);
  border: 1px solid rgba(79, 102, 95, 0.18);
}

button.danger {
  background: var(--danger);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 26px 18px;
  color: #eef8f7;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 24%),
    linear-gradient(180deg, #123338 0%, #183f43 100%);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sidebar h2 {
  margin: 0 0 8px;
}

.sidebar .nav {
  display: grid;
  gap: 10px;
}

.sidebar .nav button {
  text-align: left;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.sidebar .nav button.active {
  background: rgba(213, 242, 237, 0.18);
  border-color: rgba(213, 242, 237, 0.45);
}

.content {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.topbar {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.topbar h1 {
  margin: 0 0 6px;
}

.topbar-actions {
  width: min(540px, 100%);
}

.inline-form {
  display: flex;
  gap: 10px;
}

.inline-form input {
  flex: 1;
}

.field-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

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

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-field input[type="checkbox"] {
  width: auto;
}

.ticket-checkbox-row {
  padding-top: 10px;
}

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

.feedback {
  min-height: 20px;
  padding: 0 4px;
}

.feedback-success {
  color: var(--success);
}

.feedback-error {
  color: var(--danger);
}

.cards,
.detail-grid,
.calendar-grid,
.layout-three {
  display: grid;
  gap: 16px;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 250, 249, 0.92));
}

.card.clickable,
.list-item.clickable {
  cursor: pointer;
}

.tone-danger {
  border-color: #efb0ab;
  background: var(--danger-soft);
}

.tone-warning {
  border-color: #ebc47a;
  background: var(--warning-soft);
}

.hero-number {
  font-size: 2.2rem;
  margin: 10px 0 6px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.layout-split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
  gap: 16px;
}

.layout-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.layout-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.list {
  display: grid;
  gap: 12px;
}

.compact-list .list-item {
  padding: 14px;
}

.list-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.list-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 600;
}

.tag-danger {
  background: var(--danger-soft);
  border-color: #efb0ab;
}

.tag-warning {
  background: var(--warning-soft);
  border-color: #ebc47a;
}

.tag-success {
  background: var(--success-soft);
  border-color: #98d2b2;
}

.tag-neutral {
  background: var(--panel-strong);
  border-color: var(--line-strong);
  color: var(--text);
}

.filters,
.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-grid .full {
  grid-column: 1 / -1;
}

.filter-actions,
.form-actions,
.section-actions,
.action-bar,
.pagination {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-actions,
.form-actions {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}

.section-title h2,
.section-shell h2,
.section-shell h3 {
  margin: 0;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.nested-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.document-viewer {
  width: 100%;
  min-height: 540px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.calendar-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.calendar-grid.day {
  grid-template-columns: 1fr;
}

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

.calendar-day {
  min-height: 220px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-muted);
}

.calendar-day header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.pagination {
  justify-content: flex-end;
  margin-top: 18px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .layout-split,
  .layout-two,
  .layout-three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .content {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
  }

  .inline-form,
  .filter-actions,
  .form-actions,
  .section-actions,
  .action-bar,
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
  }
}

.qr-preview {
  width: 220px;
  max-width: 100%;
  border-radius: 12px;
  background: #fff;
  padding: 0.5rem;
}

.code-block {
  padding: 1rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.08);
  overflow: auto;
  white-space: pre-wrap;
}

.inline-select {
  min-width: 220px;
}

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

.ordered-help-list {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.45rem;
}

.help-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.highlight-target {
  outline: 2px solid rgba(20, 63, 82, 0.24);
  box-shadow: 0 0 0 6px rgba(20, 63, 82, 0.08);
}

.batch-toolbar {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.batch-toolbar .inline-select {
  min-width: 260px;
}

.selection-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.dra-law-button {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  border-radius: 999px;
  padding-inline: 22px;
  box-shadow: var(--shadow);
}

.dra-law-button.active {
  background: linear-gradient(180deg, #0f3f45 0%, #0a3035 100%);
}

.dra-law-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(430px, 100vw);
  height: 100vh;
  padding: 20px;
  background: rgba(244, 250, 248, 0.98);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 48px rgba(35, 29, 24, 0.12);
  transform: translateX(105%);
  transition: transform 0.18s ease;
  z-index: 29;
  overflow-y: auto;
}

.dra-law-panel.open {
  transform: translateX(0);
}

.dra-law-shell {
  display: grid;
  gap: 16px;
}

.dra-law-header,
.dra-law-context-card,
.dra-law-welcome {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.dra-law-search {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.accent-card {
  background: linear-gradient(135deg, rgba(23, 79, 87, 0.96), rgba(46, 120, 108, 0.92));
  color: #f6fcfb;
}

.accent-card .eyebrow,
.accent-card .muted {
  color: rgba(246, 252, 251, 0.82);
}

.selected-item {
  border-color: rgba(23, 79, 87, 0.34);
  box-shadow: 0 0 0 3px rgba(23, 79, 87, 0.1);
}

.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.word-wrap-anywhere {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tickets-layout {
  align-items: start;
}

.ticket-list-item {
  width: 100%;
  text-align: left;
  background: rgba(247, 251, 250, 0.96);
  color: var(--text);
  border: 1px solid var(--line);
}

.ticket-thread {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.ticket-message {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.ticket-message header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.ticket-message-internal {
  background: rgba(255, 247, 231, 0.88);
}

.checkbox-card {
  display: flex;
  gap: 12px;
  align-items: start;
}

.checkbox-card input[type="checkbox"] {
  width: auto;
  margin-top: 4px;
}

.dra-law-overview-card {
  overflow: hidden;
}

.dra-law-credit-meter {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(23, 79, 87, 0.1);
  overflow: hidden;
  margin: 14px 0 18px;
}

.dra-law-credit-meter-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f7b63 0%, #22a57d 100%);
}

.dra-law-sidebar,
.dra-law-workspace {
  gap: 18px;
}

.dra-law-sidebar {
  display: grid;
  align-content: start;
}

.dra-law-workspace {
  display: grid;
  align-content: start;
}

.dra-law-composer-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 247, 246, 0.92));
}

.dra-law-profile-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dra-law-profile-selector button {
  min-width: 130px;
}

.dra-law-document-list {
  max-height: 320px;
  overflow: auto;
}

.dra-law-message-list {
  display: grid;
  gap: 14px;
}

.dra-law-message {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.dra-law-message-user {
  background: rgba(223, 241, 239, 0.78);
}

.dra-law-message-assistant {
  background: rgba(255, 255, 255, 0.96);
}

.dra-law-message-body {
  margin-top: 12px;
  color: var(--text);
  line-height: 1.6;
}

.dra-law-message-paragraph {
  margin: 0 0 10px;
}

.dra-law-message-paragraph:last-child {
  margin-bottom: 0;
}

.dra-law-review-block {
  position: relative;
  padding: 8px 44px 8px 10px;
  border: 1px dashed transparent;
  border-radius: 12px;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.dra-law-review-block:hover,
.dra-law-review-block:focus-within {
  border-color: color-mix(in srgb, var(--line-strong) 78%, transparent);
  background: color-mix(in srgb, var(--panel-strong) 94%, white 6%);
}

.dra-law-review-block.is-pending-review {
  border-color: color-mix(in srgb, rgba(23, 79, 87, 0.2) 58%, transparent);
}

.dra-law-review-block.is-trace-linked {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, rgba(45, 122, 93, 0.22) 70%, transparent);
}

.dra-law-review-block.is-rewritten {
  border-color: color-mix(in srgb, rgba(164, 99, 21, 0.45) 70%, transparent);
  background: color-mix(in srgb, rgba(255, 247, 231, 0.75) 76%, white 24%);
}

.dra-law-review-block.is-reviewing {
  border-color: color-mix(in srgb, rgba(23, 79, 87, 0.5) 72%, transparent);
  background: color-mix(in srgb, var(--accent-soft) 44%, white 56%);
  box-shadow: 0 0 0 2px color-mix(in srgb, rgba(23, 79, 87, 0.12) 80%, transparent);
}

.dra-law-review-block.is-approved {
  border-color: color-mix(in srgb, rgba(42, 115, 75, 0.46) 70%, transparent);
  background: color-mix(in srgb, rgba(235, 248, 242, 0.82) 74%, white 26%);
}

.dra-law-review-handle {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, white 8%);
  color: var(--muted);
  font-size: 0.68rem;
  padding: 2px 8px;
  opacity: 0;
  pointer-events: none;
}

.dra-law-review-block:hover .dra-law-review-handle,
.dra-law-review-block:focus-within .dra-law-review-handle {
  opacity: 1;
  pointer-events: auto;
}

.dra-law-review-chip-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 8px;
}

.dra-law-review-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1;
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, white 8%);
  color: var(--muted);
}

.dra-law-review-chip.approved {
  border-color: rgba(42, 115, 75, 0.4);
  color: #1d5f45;
}

.dra-law-review-chip.rewritten {
  border-color: rgba(164, 99, 21, 0.35);
  color: #7c4f12;
}

.dra-law-review-chip.trace {
  border-color: rgba(35, 103, 79, 0.3);
  color: #245e49;
}

.dra-law-block-popover {
  position: absolute;
  z-index: 72;
  width: min(420px, calc(100vw - 32px));
  max-height: min(62vh, 520px);
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 92%, white 8%);
  box-shadow: 0 18px 48px rgba(18, 25, 31, 0.24);
}

.dra-law-block-sheet {
  position: fixed;
  inset: 0;
  z-index: 73;
  background: rgba(10, 14, 20, 0.42);
  padding: 14px;
  display: flex;
  align-items: flex-end;
}

.dra-law-block-sheet-card {
  width: 100%;
  max-height: 72vh;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  padding: 14px;
}

.dra-law-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.dra-law-block-actions-grid {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.dra-law-block-action-support-group {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px dashed var(--line);
}

.dra-law-block-rewrite-menu {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel-strong) 88%, white 12%);
}

.dra-law-block-rewrite-menu summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
}

.dra-law-block-rewrite-options {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.dra-law-coherence-warning {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(164, 99, 21, 0.35);
  background: rgba(255, 247, 231, 0.92);
}

.dra-law-strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.dra-law-trace-inline {
  display: inline-flex;
  margin-left: 6px;
  vertical-align: middle;
}

.dra-law-trace-anchor {
  border: 0;
  background: transparent;
  border-radius: 0;
  font-size: 0.74rem;
  line-height: 1.1;
  padding: 0;
  color: #2f8c67;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  cursor: pointer;
  box-shadow: none;
  opacity: 0.92;
}

.dra-law-trace-anchor:hover {
  color: #256f53;
  opacity: 1;
}

.dra-law-trace-anchor:focus-visible {
  outline: 2px solid color-mix(in srgb, #2d7a5d 34%, transparent);
  outline-offset: 2px;
}

.dra-law-trace-popover {
  position: absolute;
  z-index: 60;
  width: min(520px, calc(100vw - 32px));
  max-height: min(62vh, 520px);
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 92%, white 8%);
  box-shadow: 0 18px 48px rgba(18, 25, 31, 0.24);
}

.dra-law-trace-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(10, 14, 20, 0.42);
  padding: 14px;
  display: flex;
  align-items: flex-end;
}

.dra-law-trace-sheet-card {
  width: 100%;
  max-height: 72vh;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  padding: 14px;
}

.dra-law-trace-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.dra-law-trace-list {
  margin-top: 10px;
}

@media (hover: none), (pointer: coarse) {
  .dra-law-review-handle {
    opacity: 1;
    pointer-events: auto;
  }
}

@media print {
  .dra-law-review-block {
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
  }

  .dra-law-review-handle,
  .dra-law-trace-inline,
  .dra-law-trace-anchor,
  .dra-law-trace-popover,
  .dra-law-trace-sheet,
  .dra-law-block-popover,
  .dra-law-block-sheet,
  .dra-law-review-chip-wrap {
    display: none !important;
  }
}

.dra-law-commercial-card,
.dra-law-process-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 248, 246, 0.94));
}

.dra-law-ledger-list,
.dra-law-inline-list,
.dra-law-guidance-list {
  display: grid;
  gap: 10px;
}

.dra-law-provider-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(164, 99, 21, 0.09);
  border: 1px solid rgba(164, 99, 21, 0.18);
}

.dra-law-workspace .tone-warning {
  background: linear-gradient(180deg, rgba(255, 247, 231, 0.96), rgba(255, 251, 242, 0.94));
}

.settings-ai-ledger .list-item,
.dra-law-ledger-list .list-item {
  background: rgba(248, 251, 250, 0.98);
}

.theme-panel {
  border-style: solid;
  border-width: 1px;
  border-image: linear-gradient(120deg, color-mix(in srgb, var(--accent) 38%, transparent), var(--line)) 1;
}

.membership-form {
  display: grid;
  gap: 12px;
}

.dra-law-body {
  overflow-wrap: anywhere;
  word-break: break-word;
}

html[data-theme-resolved="dark"] .document-viewer,
html[data-theme-resolved="dark"] .qr-preview {
  background: rgba(18, 27, 34, 0.98);
  border-color: var(--line-strong);
}

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

  .login-hero-panel,
  .login-panel,
  .login-support-panel {
    padding: 22px;
  }

  .dra-law-button {
    right: 16px;
    bottom: 16px;
  }

  .dra-law-panel {
    width: 100vw;
    padding: 14px;
  }

  .runtime-banner {
    font-size: 0.82rem;
    padding: 8px 10px;
  }
}

/* V0.53 premium theme system */
:root {
  --font-sans: "IBM Plex Sans", "Segoe UI Variable", "Segoe UI", "Trebuchet MS", sans-serif;
  --font-display: "Space Grotesk", "IBM Plex Sans", "Segoe UI Variable", sans-serif;
  --bg: #edf2f7;
  --bg-elevated: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 251, 0.96));
  --bg-app: radial-gradient(circle at top left, rgba(12, 94, 120, 0.10), transparent 26%), radial-gradient(circle at top right, rgba(11, 128, 103, 0.09), transparent 22%), linear-gradient(180deg, #f7fbff 0%, #edf2f7 100%);
  --sidebar-bg: linear-gradient(180deg, #0f2d36 0%, #153f49 48%, #0f2f38 100%);
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(246, 250, 252, 0.96);
  --panel-muted: rgba(243, 247, 250, 0.92);
  --line: rgba(92, 116, 128, 0.18);
  --line-strong: rgba(42, 67, 79, 0.28);
  --text: #172630;
  --muted: #60707d;
  --accent: #0f6076;
  --accent-strong: #0a4757;
  --accent-soft: rgba(204, 236, 244, 0.92);
  --danger: #b54848;
  --danger-soft: rgba(255, 238, 236, 0.94);
  --warning: #ad6f17;
  --warning-soft: rgba(255, 247, 224, 0.96);
  --success: #1d7c61;
  --success-soft: rgba(235, 248, 242, 0.95);
  --shadow: 0 24px 56px rgba(18, 34, 44, 0.12);
  --shadow-soft: 0 14px 34px rgba(18, 34, 44, 0.08);
}

html {
  color-scheme: light;
}

html[data-theme-resolved="dark"] {
  color-scheme: dark;
}

html[data-theme-resolved="dark"] {
  --bg: #0c141a;
  --bg-elevated: linear-gradient(180deg, rgba(17, 25, 31, 0.96), rgba(13, 20, 26, 0.94));
  --bg-app: radial-gradient(circle at top left, rgba(22, 97, 128, 0.18), transparent 28%), radial-gradient(circle at top right, rgba(21, 132, 105, 0.14), transparent 24%), linear-gradient(180deg, #091015 0%, #0c141a 100%);
  --sidebar-bg: linear-gradient(180deg, #061117 0%, #0a1d26 44%, #07141b 100%);
  --panel: rgba(13, 20, 26, 0.84);
  --panel-strong: rgba(19, 28, 35, 0.94);
  --panel-muted: rgba(16, 24, 31, 0.92);
  --line: rgba(132, 163, 179, 0.16);
  --line-strong: rgba(151, 190, 208, 0.28);
  --text: #eef6fb;
  --muted: #9bb0bd;
  --accent: #4fc4e1;
  --accent-strong: #2495b6;
  --accent-soft: rgba(22, 62, 73, 0.85);
  --danger: #ff867f;
  --danger-soft: rgba(70, 28, 27, 0.86);
  --warning: #ffc971;
  --warning-soft: rgba(63, 47, 19, 0.9);
  --success: #63d3ae;
  --success-soft: rgba(20, 59, 49, 0.88);
  --shadow: 0 28px 66px rgba(3, 7, 10, 0.42);
  --shadow-soft: 0 16px 38px rgba(3, 7, 10, 0.28);
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text);
  min-height: 100vh;
}

h1,
h2,
h3,
.hero-number,
.sidebar h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.panel {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.section-shell {
  padding: 26px;
}

.login-shell {
  position: relative;
  background: var(--bg-app);
}

.shell-utility-bar {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto 18px;
  display: flex;
  justify-content: flex-end;
}

.theme-control {
  display: inline-grid;
  gap: 6px;
  min-width: 170px;
}

.theme-control span {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.theme-control select {
  min-width: 160px;
  border-radius: 14px;
  padding: 11px 14px;
  background: var(--panel-strong);
}

.theme-control-inline {
  margin-right: 8px;
}

.theme-control-panel {
  align-content: start;
}

.theme-panel-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 0.9fr) repeat(2, minmax(220px, 1fr));
}

.theme-preview-card {
  min-height: 100%;
}

.login-layout {
  gap: 26px;
}

.login-hero-panel,
.login-panel,
.login-support-panel,
.topbar,
.card,
.list-item,
.empty {
  background: var(--bg-elevated);
}

.login-hero-panel {
  border: 1px solid var(--line);
}

.app-shell {
  position: relative;
  background: transparent;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 18%);
  pointer-events: none;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.sidebar .nav button {
  border-radius: 18px;
  padding: 13px 14px;
}

.sidebar .nav button.active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 10px 24px rgba(2, 8, 13, 0.18);
}

.content {
  padding: 32px;
  gap: 22px;
}

#view-root {
  display: grid;
  gap: 22px;
}

.topbar {
  position: sticky;
  top: 18px;
  z-index: 20;
  padding: 22px 24px;
  align-items: center;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  width: min(760px, 100%);
}

.inline-form {
  flex: 1;
}

.inline-form input {
  min-width: 220px;
}

button,
input,
select,
textarea {
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

button.secondary {
  background: linear-gradient(180deg, rgba(239, 245, 247, 0.94) 0%, rgba(221, 232, 236, 0.96) 100%);
  color: var(--text);
}

html[data-theme-resolved="dark"] button.secondary {
  background: linear-gradient(180deg, rgba(22, 33, 40, 0.96) 0%, rgba(16, 24, 31, 0.98) 100%);
}

.feedback {
  min-height: 24px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px dashed transparent;
  background: rgba(255, 255, 255, 0.32);
}

.feedback:empty {
  display: none;
}

.feedback-success,
.feedback-error,
.feedback-warning {
  border-style: solid;
}

.feedback-success {
  color: var(--success);
  border-color: rgba(33, 121, 93, 0.22);
  background: var(--success-soft);
}

.feedback-error {
  color: var(--danger);
  border-color: rgba(181, 72, 72, 0.22);
  background: var(--danger-soft);
}

.feedback-warning {
  color: var(--warning);
  border-color: rgba(173, 111, 23, 0.24);
  background: var(--warning-soft);
}

.card,
.list-item,
.empty,
.nested-panel {
  border-color: var(--line);
}

.card {
  padding: 20px;
  border-radius: 24px;
}

.list-item {
  padding: 18px;
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.section-title {
  margin-bottom: 18px;
}

.section-title h2,
.section-shell h2 {
  font-size: clamp(1.18rem, 1.5vw, 1.4rem);
}

.section-shell h3 {
  font-size: 1.02rem;
}

.hero-number {
  font-size: clamp(2rem, 2.2vw, 2.5rem);
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.tag {
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--panel-strong);
}

.empty {
  padding: 22px;
  border-style: dashed;
  background: color-mix(in srgb, var(--panel-strong) 78%, transparent);
}

.nested-panel {
  margin-top: 20px;
  padding-top: 20px;
}

.form-grid {
  gap: 14px;
}

.action-bar,
.form-actions,
.filter-actions,
.section-actions,
.pagination {
  gap: 12px;
}

.compact-list .list-item {
  padding: 16px;
}

.hero-list-item {
  background: color-mix(in srgb, var(--panel-strong) 84%, transparent);
}

.highlight-target {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent), var(--shadow-soft);
}

@media (max-width: 1080px) {
  .theme-panel-grid,
  .layout-split,
  .layout-two,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .topbar {
    position: static;
  }
}

@media (max-width: 720px) {
  .shell-utility-bar,
  .content {
    width: 100%;
  }

  .shell-utility-bar {
    padding: 0 0 8px;
  }

  .topbar-actions,
  .inline-form {
    width: 100%;
    flex-direction: column;
  }

  .theme-control,
  .theme-control select {
    width: 100%;
  }
}
