:root {
  --ink: #101318;
  --muted: #687382;
  --line: #e5e9ef;
  --canvas: #f4f6f9;
  --paper: #ffffff;
  --green: #ef1717;
  --green-dark: #bd0000;
  --green-soft: #fff0f0;
  --gold: #139ee9;
  --gold-soft: #e8f7ff;
  --red: #ef1717;
  --red-soft: #ffe7e7;
  --blue: #139ee9;
  --blue-soft: #e8f7ff;
  --shadow: 0 22px 55px rgba(11, 14, 20, .12);
}

body {
  background:
    radial-gradient(circle at 14% 0%, rgba(239, 23, 23, .09), transparent 27rem),
    radial-gradient(circle at 92% 9%, rgba(19, 158, 233, .14), transparent 24rem),
    linear-gradient(135deg, #fbfcfe 0%, #f3f6fa 46%, #edf2f7 100%);
}

.sidebar {
  background:
    radial-gradient(circle at 50% -5%, rgba(239, 23, 23, .26), transparent 9.5rem),
    linear-gradient(180deg, #050607 0%, #10141a 54%, #07080a 100%);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.08), 18px 0 60px rgba(5, 8, 12, .18);
}

.brand {
  display: grid;
  gap: 9px;
  justify-items: center;
  padding: 2px 8px 28px;
  text-align: center;
}

.brand-logo {
  width: min(176px, 100%);
  height: auto;
  display: block;
  border-radius: 10px;
  filter: drop-shadow(0 15px 22px rgba(239, 23, 23, .14));
}

.brand-copy,
.brand-mark {
  display: none;
}

.main-nav a {
  border: 1px solid transparent;
  color: #aeb8c5;
}

.main-nav a span {
  color: #e5ebf2;
}

.main-nav a:hover,
.main-nav a.active {
  color: #ffffff;
  border-color: rgba(239, 23, 23, .34);
  background: linear-gradient(90deg, rgba(239, 23, 23, .20), rgba(19, 158, 233, .07));
}

.main-nav a b {
  color: #ffffff;
  background: #ef1717;
}

.sync-card,
.role-menu {
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.065);
}

.sync-dot {
  background: #139ee9;
  box-shadow: 0 0 0 4px rgba(19, 158, 233, .16);
}

.sync-card small,
.profile-button small {
  color: #91a0af;
}

.profile-button {
  border-top-color: rgba(255,255,255,.13);
  background: rgba(8, 11, 15, .9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

.profile-button strong {
  color: #f7fbff;
}

.role-menu button:hover {
  background: rgba(239, 23, 23, .16);
}

.avatar {
  color: #ffffff;
  background: linear-gradient(135deg, #ef1717, #9d0000);
}

.topbar {
  border-bottom-color: rgba(14, 19, 27, .08);
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 10px 30px rgba(11, 14, 20, .05);
}

.breadcrumbs strong {
  color: #101318;
}

.icon-button,
.secondary-button,
.filter-chip,
.search,
.form-grid input,
.form-grid select,
.form-grid textarea,
.close-button {
  background: #ffffff;
}

.primary-button {
  border-color: #d60000;
  background: linear-gradient(135deg, #ff1d1d, #bd0000);
  box-shadow: 0 12px 24px rgba(239, 23, 23, .21);
}

.primary-button:hover {
  background: linear-gradient(135deg, #e50000, #990000);
}

.secondary-button:hover,
.filter-chip:hover {
  border-color: rgba(19, 158, 233, .45);
  color: #0a75ad;
}

.search:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.bid-form-grid input:focus,
.bid-form-grid select:focus,
.bid-form-grid textarea:focus {
  border-color: rgba(19, 158, 233, .55);
  box-shadow: 0 0 0 3px rgba(19, 158, 233, .13);
}

.page-heading {
  padding: 24px;
  border: 1px solid rgba(239, 23, 23, .11);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.97), rgba(255,255,255,.84)),
    radial-gradient(circle at right top, rgba(239,23,23,.14), transparent 18rem),
    radial-gradient(circle at left bottom, rgba(19,158,233,.14), transparent 18rem);
  box-shadow: 0 18px 40px rgba(11,14,20,.07);
}

.eyebrow {
  color: #139ee9;
}

h1,
h2 {
  color: #07090d;
  letter-spacing: -.04em;
}

.page-heading p {
  color: #596676;
}

.stat-card,
.panel,
.table-card,
.calendar,
.modal,
.job-card {
  border-color: rgba(14, 19, 27, .09);
  background: rgba(255,255,255,.96);
  box-shadow: 0 16px 34px rgba(11, 14, 20, .07);
}

.stat-card,
.panel,
.table-card,
.calendar {
  border-radius: 20px;
}

.stat-card::after {
  width: 96px;
  height: 96px;
  background: radial-gradient(circle, rgba(239, 23, 23, .13), transparent 70%);
}

.stat-card.gold::after,
.stat-card.blue::after {
  background: radial-gradient(circle, rgba(19, 158, 233, .18), transparent 70%);
}

.stat-card strong,
.panel-head h3,
.job-card h3 {
  color: #101318;
}

.text-button,
.job-card .job-id {
  color: #d60000;
}

.pipeline-bar {
  background: #e8edf3;
}

.pipeline-bar i {
  background: linear-gradient(90deg, #ef1717, #139ee9);
}

.pipeline-row:nth-child(2n) i {
  background: linear-gradient(90deg, #111722, #139ee9);
}

th {
  color: #707b88;
  background: #f4f7fa;
}

td {
  border-top-color: #edf0f4;
}

tbody tr:hover {
  background: #fbfdff;
}

.status {
  color: #c90000;
  background: #fff0f0;
}

.status.gold,
.status.blue {
  color: #0a6fa7;
  background: #e8f7ff;
}

.status.red {
  color: #b00000;
  background: #ffe7e7;
}

.kanban-column {
  border: 1px solid rgba(14, 19, 27, .07);
  background: #edf1f5;
}

.kanban-head span {
  background: #dce4ec;
}

.job-card {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.job-card:hover {
  border-color: rgba(239, 23, 23, .40);
  box-shadow: 0 18px 34px rgba(11, 14, 20, .11);
}

.date-tile,
.day.today > span {
  color: #ffffff;
  background: linear-gradient(135deg, #ef1717, #a90000);
}

.cal-event {
  border-color: #ef1717;
  color: #521414;
  background: #fff0f0;
}

.cal-event.gold {
  border-color: #139ee9;
  color: #0b5d8c;
  background: #e8f7ff;
}

.mini-avatar {
  color: #075d8c;
  background: #e8f7ff;
}

.modal {
  border-radius: 18px;
}

.modal::backdrop {
  background: rgba(5, 8, 12, .68);
}

#authDialog .modal-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

#authDialog .eyebrow {
  color: #ef1717;
}

.toast {
  background: linear-gradient(135deg, #101318, #bd0000);
}

.sync-note,
.integration-copy {
  color: var(--muted);
  font-size: var(--font-md);
  line-height: 1.6;
}

.filter-row .sync-note {
  margin-left: auto;
}

.wix-card {
  margin-bottom: 18px;
}

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

.rule-list div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #f8fbfe);
}

.rule-list b,
.rule-list span {
  display: block;
}

.rule-list b {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: var(--font-base);
}

.rule-list span {
  color: var(--muted);
  font-size: var(--font-md);
  line-height: 1.5;
}

.bid-form-grid input,
.bid-form-grid select,
.bid-form-grid textarea {
  background: #ffffff;
}

.quote-context-list article {
  border-color: rgba(14, 19, 27, .08);
  background: linear-gradient(135deg, #ffffff, #f8fbfe);
}

.quote-context-list footer b {
  color: #0a6fa7;
  background: #e8f7ff;
}

@media (max-width: 760px) {
  body {
    background:
      radial-gradient(circle at 50% -8%, rgba(239, 23, 23, .12), transparent 18rem),
      linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
  }

  .sidebar {
    width: min(310px, 86vw);
    max-width: calc(100vw - 44px);
    padding: 16px 16px 18px;
  }

  .sync-card,
  .profile-button,
  .role-menu {
    background: rgba(9, 12, 16, .96);
    backdrop-filter: blur(14px);
  }

  .profile-button {
    padding: 12px 10px;
    border: 1px solid rgba(255,255,255,.12);
    border-top-color: rgba(255,255,255,.12);
    border-radius: 14px;
  }

  .profile-button small,
  .role-menu button,
  .text-size-label {
    color: #dfe7f1;
  }

  .role-menu {
    box-shadow: 0 18px 34px rgba(0,0,0,.28);
  }

  .brand-logo {
    width: 154px;
  }

  .main-nav {
    gap: 8px;
  }

  .main-nav a {
    min-height: 50px;
    border-radius: 14px;
    font-size: var(--font-xl);
  }

  .topbar {
    height: 66px;
    padding: 0 14px;
  }

  .sidebar-mobile-head {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }

  .sidebar-close {
    border-color: rgba(255,255,255,.14);
    background: rgba(255,255,255,.06);
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
  }

  .mobile-menu,
  .icon-button {
    min-width: 44px;
    min-height: 44px;
  }

  .top-actions {
    gap: 8px;
  }

  .primary-button,
  .secondary-button,
  .filter-chip {
    min-height: 46px;
    border-radius: 12px;
    font-size: var(--font-lg);
  }

  .top-actions .primary-button {
    padding: 0 14px;
  }

  .page {
    padding: 18px 13px calc(104px + env(safe-area-inset-bottom, 0px));
  }

  .page-heading {
    padding: 20px;
    border-radius: 20px;
  }

  .page-heading .view-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .page-heading .view-actions button {
    flex: 1 1 130px;
  }

  h1 {
    font-size: clamp(28px, 9vw, 36px);
  }

  .page-heading p {
    font-size: var(--font-xl);
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    border-radius: 17px;
  }

  .dashboard-grid,
  .schedule-layout {
    gap: 13px;
  }

  .panel,
  .table-card,
  .calendar {
    border-radius: 18px;
  }

  .filter-row {
    min-width: 0;
    flex-wrap: wrap;
    padding: 12px;
  }

  .filter-row .sync-note {
    width: 100%;
    margin-left: 0;
  }

  .search {
    min-width: 100%;
    min-height: 46px;
  }

  .filter-chip {
    flex: 1 1 calc(50% - 8px);
  }

  .kanban {
    grid-template-columns: repeat(4, minmax(82vw, 1fr));
    scroll-snap-type: x proximity;
  }

  .workflow-kanban {
    grid-template-columns: repeat(5, minmax(82vw, 1fr));
  }

  .kanban-column {
    min-height: 360px;
    scroll-snap-align: start;
  }

  .job-card {
    padding: 15px;
    border-radius: 15px;
  }

  .job-card h3 {
    font-size: var(--font-2xl);
  }

  .job-card p {
    min-height: 0;
    font-size: var(--font-base);
  }

  .modal {
    width: min(100vw - 18px, 680px);
    max-height: calc(100dvh - 18px);
    overflow: auto;
    border-radius: 22px;
  }

  .modal form,
  .detail-modal > div {
    padding: 20px;
  }

  .modal-head {
    gap: 14px;
    margin-bottom: 18px;
  }

  .close-button {
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
  }

  .form-grid {
    gap: 13px;
  }

  .form-grid label {
    font-size: var(--font-base);
  }

  .form-grid input,
  .form-grid select,
  .form-grid textarea {
    min-height: 48px;
    border-radius: 12px;
    font-size: var(--font-2xl);
  }

  .form-grid textarea {
    min-height: 118px;
  }

  .text-size-menu {
    gap: 10px;
    padding: 12px 10px;
  }

  .text-size-control button {
    min-height: 40px;
    font-size: var(--font-md);
  }

  .modal-actions {
    position: sticky;
    right: 0;
    bottom: -20px;
    left: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 18px -20px -20px;
    padding: 14px 20px 20px;
    background: linear-gradient(180deg, rgba(255,255,255,.88), #ffffff 32%);
  }

  .inline-actions {
    position: static;
    display: flex;
    grid-template-columns: none;
    margin: 16px 0 0;
    padding: 0;
    background: transparent;
  }

  .modal-actions button {
    width: 100%;
  }

  .inline-actions button {
    width: auto;
  }

  .toast {
    right: 12px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    text-align: center;
  }

  .mobile-tabbar {
    border-color: rgba(14, 19, 27, .10);
    box-shadow: 0 14px 28px rgba(11, 14, 20, .16);
  }

  .mobile-tabbar a.active {
    background: linear-gradient(135deg, #ef1717, #bd0000);
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 220px 1fr;
  }

  .sidebar {
    width: 220px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .brand-logo {
    width: 150px;
  }

  .page {
    padding: 26px;
  }

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

@media (max-width: 520px) {
  .top-actions .primary-button span {
    display: none;
  }

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

  .stat-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    align-items: center;
  }

  .stat-card span,
  .stat-card small {
    grid-column: 1;
  }

  .stat-card strong {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
    font-size: calc(28px * var(--app-text-scale));
  }

  .filter-chip {
    flex-basis: 100%;
  }

  .calendar-head div {
    padding: 8px 2px;
    font-size: var(--font-2xs);
  }

  .day {
    min-height: 82px;
    padding: 6px;
  }

  .cal-event {
    padding: 5px;
    font-size: var(--font-2xs);
  }
}
