:root {
  color-scheme: light;
  --font-body: "Roboto Flex", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Manrope", "Roboto Flex", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;

  --text-xs: clamp(0.74rem, 0.71rem + 0.1vw, 0.81rem);
  --text-sm: clamp(0.84rem, 0.81rem + 0.12vw, 0.92rem);
  --text-md: clamp(0.95rem, 0.92rem + 0.16vw, 1.02rem);
  --text-lg: clamp(1.06rem, 1rem + 0.2vw, 1.18rem);
  --text-xl: clamp(1.24rem, 1.16rem + 0.34vw, 1.44rem);
  --text-2xl: clamp(1.48rem, 1.3rem + 0.72vw, 1.92rem);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 30px;

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --bg-canvas: #edf2f9;
  --bg-tint: #e7edf6;
  --surface-1: rgba(255, 255, 255, 0.9);
  --surface-2: #ffffff;
  --surface-soft: #f6f9ff;
  --surface-hover: #eff4ff;
  --ink: #172235;
  --muted: #627089;
  --stroke-soft: rgba(25, 36, 58, 0.14);
  --stroke-subtle: rgba(25, 36, 58, 0.08);

  --brand: #1e6fd9;
  --brand-strong: #1459b7;
  --danger: #cd3d3d;

  --focus-ring: rgba(30, 111, 217, 0.24);

  --shadow-0: 0 1px 1px rgba(16, 24, 40, 0.04);
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 22px rgba(16, 24, 40, 0.06);
  --shadow-2: 0 2px 5px rgba(16, 24, 40, 0.08), 0 14px 34px rgba(16, 24, 40, 0.11);
  --shadow-3: 0 12px 36px rgba(16, 24, 40, 0.2);

  --table-head-bg: #f4f7fd;
  --table-row-divider: rgba(20, 34, 59, 0.08);

  --paper-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.22'/%3E%3C/svg%3E");
}

body.theme-dark {
  color-scheme: dark;
  --bg-canvas: #0f1723;
  --bg-tint: #121d2a;
  --surface-1: rgba(24, 34, 50, 0.85);
  --surface-2: #182338;
  --surface-soft: #1d2a40;
  --surface-hover: #22314a;
  --ink: #ecf3ff;
  --muted: #9fb0cc;
  --stroke-soft: rgba(224, 233, 255, 0.18);
  --stroke-subtle: rgba(224, 233, 255, 0.1);

  --brand: #74b4ff;
  --brand-strong: #4a97ef;
  --danger: #f47777;

  --focus-ring: rgba(116, 180, 255, 0.3);

  --shadow-0: 0 1px 1px rgba(0, 0, 0, 0.2);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.24), 0 10px 28px rgba(0, 0, 0, 0.28);
  --shadow-2: 0 2px 5px rgba(0, 0, 0, 0.3), 0 16px 36px rgba(0, 0, 0, 0.4);
  --shadow-3: 0 16px 40px rgba(0, 0, 0, 0.52);

  --table-head-bg: #1b2942;
  --table-row-divider: rgba(220, 230, 255, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  position: relative;
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: radial-gradient(circle at 12% 6%, rgba(126, 170, 228, 0.17), transparent 45%),
    radial-gradient(circle at 88% 18%, rgba(149, 188, 236, 0.1), transparent 34%),
    linear-gradient(160deg, var(--bg-canvas), var(--bg-tint));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: var(--paper-noise);
  opacity: 0.17;
  mix-blend-mode: multiply;
  z-index: -1;
}

body.theme-dark::before {
  opacity: 0.08;
  mix-blend-mode: screen;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: 1.08;
}

h2 {
  font-size: var(--text-xl);
  line-height: 1.2;
}

h3 {
  font-size: var(--text-lg);
  line-height: 1.28;
  margin-bottom: 12px;
}

.app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(18px, 2.4vw, 34px) clamp(14px, 2.8vw, 36px) 56px;
}

body.layout-boxed .app-shell {
  max-width: 1440px;
  margin-inline: auto;
}

.topbar {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: var(--space-4);
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.inline-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.inline-control select {
  min-width: 126px;
}

.settings-wrap {
  position: relative;
}

.settings-menu {
  position: absolute;
  left: 0;
  right: auto;
  top: calc(100% + 8px);
  min-width: 220px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-2);
  z-index: 30;
}

.settings-menu.hidden {
  display: none;
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-search {
  width: 100%;
  min-width: 0;
}

.eyebrow {
  margin: 0;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--brand);
  font-weight: 800;
}

.subtitle {
  margin: 8px 0 0;
  max-width: 72ch;
  color: var(--muted);
  font-size: var(--text-sm);
}

.workspace {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: clamp(14px, 1.8vw, 24px);
  margin-top: clamp(14px, 1.7vw, 22px);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.tab {
  display: block;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  padding: 10px 12px;
  font-size: var(--text-sm);
  font-weight: 650;
  cursor: pointer;
  width: 100%;
  text-align: left;
  text-decoration: none;
  transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.tab:hover {
  background: var(--surface-hover);
}

.tab.active {
  color: #ffffff;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  box-shadow: var(--shadow-1);
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 7px;
}

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

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

kbd {
  border: 0;
  border-radius: 6px;
  padding: 2px 6px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--stroke-subtle);
  font-family: inherit;
  font-size: 0.75rem;
}

main {
  min-width: 0;
}

.panel {
  display: none;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.panel.active {
  display: block;
  animation: panel-fade-in 0.24s ease;
}

@keyframes panel-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: 14px;
}

.panel-title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.helper {
  font-size: var(--text-sm);
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.metric .label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.metric strong {
  font-size: var(--text-xl);
  font-weight: 780;
  letter-spacing: -0.02em;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.stack-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.card {
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
  padding: 16px;
}

.stack {
  display: grid;
  gap: 8px;
}

.line-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--stroke-subtle), var(--shadow-0);
  font-size: var(--text-sm);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 14px;
  margin-bottom: 16px;
}

.form-panel {
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
  box-shadow: var(--shadow-1);
  padding: 16px;
}

.form-panel.is-hidden {
  display: none;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-xs);
  letter-spacing: 0.01em;
  font-weight: 650;
  text-transform: none;
}

input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  text-transform: none;
  letter-spacing: 0.01em;
  padding: 10px 12px;
  min-height: 42px;
  box-shadow: inset 0 0 0 1px var(--stroke-soft), var(--shadow-0);
  transition: box-shadow 0.16s ease, transform 0.16s ease, background-color 0.16s ease;
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}

input:not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--brand), 0 0 0 4px var(--focus-ring);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  border: 1px solid var(--stroke-soft);
  border-radius: 4px;
  box-shadow: none;
  background: var(--surface-2);
}

input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

textarea {
  resize: vertical;
}

.span-3 {
  grid-column: span 3;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.btn {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 670;
  letter-spacing: 0.01em;
  color: #ffffff;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.2), 0 8px 16px rgba(20, 89, 183, 0.3);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.22), 0 10px 18px rgba(20, 89, 183, 0.34);
}

.btn:active {
  transform: translateY(0);
  filter: saturate(0.92);
}

.btn-secondary {
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--stroke-soft), var(--shadow-0);
}

.btn-secondary:hover {
  box-shadow: inset 0 0 0 1px var(--stroke-soft), var(--shadow-1);
}

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

.table-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
}

.table-controls input,
.table-controls select {
  min-width: 170px;
  flex: 1;
  max-width: 320px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
}

.card .table-wrap {
  background: transparent;
  box-shadow: none;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.record-card {
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.record-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.record-card-head h4 {
  margin: 0;
  font-size: var(--text-md);
  line-height: 1.3;
}

.record-card-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.record-card-field {
  display: grid;
  gap: 3px;
}

.record-card-field span {
  color: var(--muted);
  font-size: var(--text-xs);
}

.record-card-field strong {
  font-size: var(--text-sm);
  font-weight: 650;
  line-height: 1.3;
}

.record-card-body {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.record-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.record-card-links a {
  color: var(--brand-strong);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

.record-card-links a:hover {
  text-decoration: underline;
}

.record-card .actions {
  margin-top: 2px;
}

.active-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chip {
  border: 0;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: var(--text-xs);
  color: var(--muted);
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--stroke-subtle);
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.empty-state {
  padding: 20px;
  color: var(--muted);
  text-align: center;
  font-size: var(--text-sm);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

#tab-leads table {
  min-width: 1800px;
}

#tab-leads td {
  max-width: 240px;
  white-space: normal;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 10px 11px;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--table-row-divider);
}

th {
  background: var(--table-head-bg);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 2;
}

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

tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-soft) 54%, transparent);
}

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

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface-1);
  z-index: 1;
}

thead th:first-child {
  z-index: 2;
  background: var(--table-head-bg);
}

#tab-leads th[data-col="company"],
#tab-leads td[data-col="company"] {
  position: sticky;
  left: 44px;
  background: var(--surface-1);
  z-index: 1;
}

#tab-leads thead th[data-col="company"] {
  z-index: 3;
  background: var(--table-head-bg);
}

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

.actions button,
.actions select {
  border: 0;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.76rem;
  min-height: 30px;
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--stroke-soft), var(--shadow-0);
}

.actions .danger {
  color: var(--danger);
  box-shadow: inset 0 0 0 1px rgba(205, 61, 61, 0.35), var(--shadow-0);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.71rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px transparent;
}

.badge.status-new,
.badge.status-prospecting,
.badge.status-open {
  background: rgba(57, 131, 232, 0.17);
  color: #1858aa;
}

.badge.status-qualified,
.badge.status-qualification,
.badge.status-in_progress,
.badge.status-proposal {
  background: rgba(66, 184, 123, 0.2);
  color: #1f7f51;
}

.badge.status-negotiation,
.badge.status-high,
.badge.status-urgent {
  background: rgba(243, 176, 52, 0.25);
  color: #8a5a10;
}

.badge.status-won,
.badge.status-customer,
.badge.status-done {
  background: rgba(35, 188, 145, 0.2);
  color: #0f785b;
}

.badge.status-lost,
.badge.status-unqualified,
.badge.status-blocked,
.badge.status-at_risk,
.badge.status-inactive {
  background: rgba(215, 87, 110, 0.21);
  color: #922c42;
}

body.theme-dark .badge.status-new,
body.theme-dark .badge.status-prospecting,
body.theme-dark .badge.status-open {
  color: #b7d9ff;
}

body.theme-dark .badge.status-qualified,
body.theme-dark .badge.status-qualification,
body.theme-dark .badge.status-in_progress,
body.theme-dark .badge.status-proposal {
  color: #c5f4df;
}

body.theme-dark .badge.status-negotiation,
body.theme-dark .badge.status-high,
body.theme-dark .badge.status-urgent {
  color: #ffe0a4;
}

body.theme-dark .badge.status-won,
body.theme-dark .badge.status-customer,
body.theme-dark .badge.status-done {
  color: #bbf4e4;
}

body.theme-dark .badge.status-lost,
body.theme-dark .badge.status-unqualified,
body.theme-dark .badge.status-blocked,
body.theme-dark .badge.status-at_risk,
body.theme-dark .badge.status-inactive {
  color: #ffd0da;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(155px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kanban-col {
  min-height: 116px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
}

.kanban-col h4 {
  margin: 0 0 8px;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.kanban-card {
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--stroke-subtle), var(--shadow-0);
  padding: 9px;
  margin-bottom: 7px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.kanban-card:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px var(--stroke-subtle), var(--shadow-1);
}

.kanban-card:last-child {
  margin-bottom: 0;
}

.kanban-card strong {
  display: block;
  font-size: var(--text-sm);
}

.kanban-card span {
  color: var(--muted);
  font-size: var(--text-xs);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
  padding: 12px;
}

.timeline-item .meta {
  color: var(--muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 5px;
  font-weight: 700;
}

.event-link {
  color: inherit;
  text-decoration: none;
}

.event-link:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 30, 0.46);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  z-index: 50;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  width: min(760px, 92vw);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  box-shadow: var(--shadow-3);
  padding: 12px;
}

.overlay-card input {
  width: 100%;
  margin-bottom: 10px;
}

.command-results {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.command-item {
  border: 0;
  border-radius: var(--radius-sm);
  text-align: left;
  padding: 10px;
  cursor: pointer;
  color: var(--ink);
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--stroke-subtle), var(--shadow-0);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.command-item:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px var(--stroke-subtle), var(--shadow-1);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(430px, 95vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  box-shadow: var(--shadow-3);
  z-index: 45;
}

.drawer.hidden {
  display: none;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px;
  box-shadow: inset 0 -1px 0 var(--stroke-subtle);
}

.drawer-content {
  overflow: auto;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.drawer-row {
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--stroke-subtle);
  padding: 8px;
}

.drawer-row strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: var(--text-sm);
  color: #f3f8ff;
  background: linear-gradient(145deg, #183761, #0f2744);
  box-shadow: var(--shadow-3);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
  }

  .tabs {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .tab {
    width: auto;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-3 {
    grid-column: span 2;
  }

  .kanban {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .table-controls {
    align-items: stretch;
  }

  .record-card-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px 12px 30px;
  }

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

  .inline-control {
    text-transform: none;
    letter-spacing: 0.01em;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-3 {
    grid-column: span 1;
  }

  .kanban {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .table-controls input,
  .table-controls select {
    min-width: 140px;
    flex: 1;
  }
}

body.density-compact th,
body.density-compact td {
  padding: 7px 8px;
}

body.density-compact input,
body.density-compact select,
body.density-compact textarea {
  padding: 8px 10px;
}

body.density-compact .btn {
  padding: 8px 12px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
