/* AutomaNext UI system v71
   A focused presentation layer over the legacy feature styles. */

:root {
  --ui-bg: #f4f6f9;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f8fafc;
  --ui-surface-strong: #eef2f7;
  --ui-ink: #12151b;
  --ui-ink-soft: #3f4652;
  --ui-muted: #697180;
  --ui-line: #d3d9e2;
  --ui-line-strong: #aeb8c6;
  --ui-brand: #3448f0;
  --ui-brand-dark: #2536c7;
  --ui-brand-soft: #eef0ff;
  --ui-success: #16834b;
  --ui-warning: #9a6100;
  --ui-danger: #bd2c2c;
  --ui-sidebar: #101319;
  --ui-sidebar-soft: #181c24;
  --ui-radius-sm: 10px;
  --ui-radius-md: 14px;
  --ui-radius-lg: 20px;
  --ui-radius-xl: 26px;
  --ui-shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .035);
  --ui-shadow-md: 0 18px 50px rgba(16, 24, 40, .09);
  --ui-ease-out: cubic-bezier(.23, 1, .32, 1);
  --ui-ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --ui-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #c4cad3 transparent;
}

html {
  color-scheme: light;
  background: var(--ui-bg);
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 86% -10%, rgba(52, 72, 240, .07), transparent 30rem),
    var(--ui-bg);
  color: var(--ui-ink);
  font-family: var(--ui-font);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -.008em;
}

::selection {
  background: rgba(52, 72, 240, .18);
}

a,
button,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

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

.skip-link {
  position: fixed;
  z-index: 100000;
  top: 12px;
  left: 12px;
  padding: 11px 15px;
  border-radius: var(--ui-radius-sm);
  background: var(--ui-ink);
  color: #fff;
  font-weight: 750;
  transform: translateY(-160%);
  transition: transform 160ms var(--ui-ease-out);
}

.skip-link:focus {
  color: #fff;
  transform: translateY(0);
}

/* Application shell */

.app {
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  z-index: 60;
  height: 100dvh;
  padding: 20px 14px 16px;
  gap: 16px;
  overflow: hidden;
  border: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(73, 91, 255, .2), transparent 18rem),
    var(--ui-sidebar);
  color: #fff;
  box-shadow: 10px 0 30px rgba(10, 13, 19, .08);
  backdrop-filter: none;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
}

.brand img {
  width: 168px;
  max-height: 34px;
  object-fit: contain;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
}

.nav-toggle > span:not(.sr-only) {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  border-radius: 99px;
  background: currentColor;
  transition: transform 160ms var(--ui-ease-out), opacity 120ms ease;
}

.nav {
  display: block;
  min-height: 0;
  flex: 1 1 auto;
  padding: 3px 2px 18px;
  overflow: auto;
  overscroll-behavior: contain;
}

.nav-group {
  display: grid;
  gap: 3px;
  margin: 0 0 15px;
}

.nav-group:last-child {
  margin-bottom: 0;
}

.nav-group-label {
  display: block;
  padding: 0 10px 6px;
  color: rgba(255, 255, 255, .42);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1;
  text-transform: uppercase;
}

.nav a.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: rgba(255, 255, 255, .7);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.01em;
  box-shadow: none;
  transition:
    transform 140ms var(--ui-ease-out),
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.nav a.nav-item::before {
  display: none;
}

.nav a.nav-item:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.nav a.nav-item.active {
  border-color: rgba(122, 137, 255, .34);
  background: linear-gradient(135deg, rgba(68, 88, 255, .95), rgba(51, 65, 219, .92));
  color: #fff;
  box-shadow: 0 9px 20px rgba(31, 47, 190, .26);
}

.nav-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: currentColor;
  opacity: .9;
}

.nav-icon svg {
  display: block;
  width: 18px;
  height: 18px;
}

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

.nav-badge {
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  background: #fff;
  color: var(--ui-sidebar);
  font-size: 10px;
  box-shadow: none;
}

.nav a.active .nav-badge {
  background: rgba(255, 255, 255, .2);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .22);
}

.profile {
  flex: 0 0 auto;
  margin: 0;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 15px;
  background: rgba(255, 255, 255, .055);
  grid-template-columns: 36px minmax(0, 1fr);
}

.profile .avatar {
  width: 36px;
  height: 36px;
  background: #fff;
  color: var(--ui-sidebar);
}

.profile strong {
  color: #fff;
  font-size: 13px;
}

.profile small {
  color: rgba(255, 255, 255, .5);
  font-size: 11px;
}

.profile .logout {
  grid-column: 2;
  justify-self: start;
  margin-top: -5px;
  color: rgba(255, 255, 255, .58);
  font-size: 11px;
  font-weight: 700;
}

.profile .logout:hover {
  color: #fff;
}

.main {
  width: 100%;
  max-width: 1600px;
  min-width: 0;
  margin: 0 auto;
  padding: 32px clamp(24px, 3.6vw, 54px) 58px;
}

/* Authentication */

.auth-page {
  position: relative;
  min-height: 100dvh;
  padding: 28px;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(15, 18, 25, .97), rgba(24, 29, 48, .94)),
    var(--ui-sidebar);
}

.auth-page::before,
.auth-page::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}

.auth-page::before {
  top: -18rem;
  right: -10rem;
  width: 42rem;
  height: 42rem;
  background: radial-gradient(circle, rgba(75, 94, 255, .42), transparent 68%);
}

.auth-page::after {
  bottom: -26rem;
  left: -16rem;
  width: 50rem;
  height: 50rem;
  background: radial-gradient(circle, rgba(64, 83, 236, .18), transparent 66%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(450px, 100%);
  padding: 38px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 24px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 32px 90px rgba(0, 0, 0, .3);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--ui-brand), #6d7cff);
}

.login-card img {
  width: 178px;
}

.login-card h1 {
  margin: 30px 0 8px;
  color: var(--ui-ink);
  font-size: 32px;
  font-weight: 760;
  letter-spacing: -.045em;
}

.login-card > p,
.login-card form + p {
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.6;
}

.login-card form {
  gap: 16px;
  margin-top: 24px;
}

.login-card .primary {
  width: 100%;
  margin-top: 2px;
}

.login-card a {
  color: var(--ui-brand-dark);
  font-weight: 700;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ui-ink);
  box-shadow: 0 0 0 1000px #fff inset !important;
  transition: background-color 9999s ease-out;
}

/* Typography and page headers */

.eyebrow {
  display: block;
  color: var(--ui-brand);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.topbar {
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.topbar h1 {
  max-width: 900px;
  margin: 4px 0 7px;
  color: var(--ui-ink);
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 760;
  line-height: 1.02;
  letter-spacing: -.052em;
}

.topbar p {
  max-width: 760px;
  color: var(--ui-muted);
  font-size: 14px;
  line-height: 1.6;
}

.role-admin.page-dashboard .topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr);
  align-items: stretch;
  padding: clamp(24px, 3vw, 36px);
  border: 1px solid #252a36;
  border-radius: var(--ui-radius-xl);
  background:
    radial-gradient(circle at 70% 0%, rgba(80, 97, 255, .22), transparent 24rem),
    linear-gradient(135deg, #11151e, #1a2030);
  box-shadow: var(--ui-shadow-md);
}

.role-admin.page-dashboard .topbar .eyebrow {
  color: #9ca8ff;
}

.role-admin.page-dashboard .topbar h1 {
  color: #fff;
}

.role-admin.page-dashboard .topbar p {
  color: rgba(255, 255, 255, .64);
}

.role-admin.page-dashboard .stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-self: stretch;
}

.role-admin.page-dashboard .stat {
  min-width: 0;
  padding: 16px;
  border-color: rgba(255, 255, 255, .1);
  border-radius: 15px;
  background: rgba(255, 255, 255, .075);
  color: #fff;
  box-shadow: none;
}

.role-admin.page-dashboard .stat strong {
  color: #fff;
  font-size: 25px;
}

.role-admin.page-dashboard .stat span {
  color: rgba(255, 255, 255, .58);
}

/* Cards and layout */

.grid {
  gap: 18px;
  margin-bottom: 18px;
}

.two-col,
.three-col {
  gap: 18px;
}

.card {
  padding: 23px;
  overflow: auto;
  border: 1px solid #d3d9e2;
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-sm), inset 0 0 0 1px rgba(18, 21, 27, .012);
}

.card + .card,
.grid + .card,
.card + .grid {
  margin-top: 18px;
}

.card h2 {
  margin-bottom: 17px;
  color: var(--ui-ink);
  font-size: 19px;
  font-weight: 740;
  letter-spacing: -.035em;
}

.card h3 {
  color: var(--ui-ink-soft);
}

.card p {
  color: var(--ui-ink-soft);
  line-height: 1.65;
}

.card-head {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.card-head h2 {
  margin: 0;
}

.list-item {
  gap: 18px;
  padding: 16px 0;
}

.list-item strong,
.task-row strong,
.file-row strong {
  color: var(--ui-ink);
  font-weight: 700;
}

.metrics,
.portal-stats,
.website-metrics,
.affiliate-admin-stats {
  gap: 12px;
}

.metrics > div,
.portal-stat,
.website-metrics article,
.affiliate-admin-card,
.client-overview-strip div {
  border: 1px solid var(--ui-line);
  border-radius: 16px;
  background: var(--ui-surface);
  box-shadow: none;
}

.stat {
  border-color: var(--ui-line);
  border-radius: 16px;
  box-shadow: var(--ui-shadow-sm);
}

.empty-state {
  border: 1px dashed var(--ui-line-strong);
  border-radius: 16px;
  background: var(--ui-surface-soft);
}

/* Controls */

.primary,
.secondary,
.soft-button,
.icon-btn,
.add-action,
.round-plus,
.slot-button {
  min-height: 42px;
  border-radius: var(--ui-radius-sm);
  font-size: 13px;
  font-weight: 730;
  transition:
    transform 140ms var(--ui-ease-out),
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.primary {
  padding: 11px 17px;
  border-color: var(--ui-brand);
  background: linear-gradient(135deg, var(--ui-brand), var(--ui-brand-dark));
  color: #fff;
  box-shadow: 0 7px 16px rgba(52, 72, 240, .2);
}

.primary:hover {
  border-color: var(--ui-brand-dark);
  background: linear-gradient(135deg, #4054fa, #293bd1);
  color: #fff;
}

.soft-button {
  width: auto;
  margin-top: 0;
  padding: 11px 15px;
  border-color: var(--ui-line);
  background: var(--ui-surface-soft);
  color: var(--ui-ink);
}

.soft-button:hover {
  border-color: var(--ui-line-strong);
  background: var(--ui-surface-strong);
}

.icon-btn {
  min-height: 36px;
  margin: 2px;
  padding: 9px 12px;
  border-color: var(--ui-line);
  border-radius: 9px;
  background: #fff;
  color: var(--ui-ink-soft);
}

.add-action {
  border-color: var(--ui-line);
  background: var(--ui-surface-soft);
}

.add-action-icon {
  background: var(--ui-ink);
  color: #fff;
}

.round-plus {
  border-radius: 11px;
  background: var(--ui-brand);
  border-color: var(--ui-brand);
}

.primary:active,
.secondary:active,
.soft-button:active,
.icon-btn:active,
.add-action:active,
.round-plus:active,
.slot-button:active,
.nav-item:active {
  transform: scale(.975);
}

button:disabled,
.primary:disabled,
.icon-btn:disabled {
  cursor: not-allowed;
  opacity: .48;
  box-shadow: none;
}

.form-grid {
  gap: 16px;
}

label {
  color: var(--ui-ink-soft);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: .005em;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
select,
textarea,
.copy-field {
  min-height: 44px;
  margin-top: 7px;
  padding: 11px 13px;
  border: 1px solid #aeb8c6;
  border-radius: 10px;
  background: #fff;
  color: var(--ui-ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), inset 0 0 0 1px rgba(18, 21, 27, .018);
}

textarea {
  min-height: 112px;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: #939aa6;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus,
.copy-field:focus {
  border-color: var(--ui-brand);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(52, 72, 240, .12);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ui-brand);
  outline-offset: 2px;
}

.checkbox {
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-surface-soft);
}

.checkbox input {
  width: 17px;
  height: 17px;
  accent-color: var(--ui-brand);
}

.toolbar {
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  background: var(--ui-surface-soft);
}

.toolbar input,
.toolbar select {
  margin-top: 0;
}

/* Tables, statuses and progress */

table {
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  padding: 11px 12px;
  border-top: 1px solid var(--ui-line);
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-surface-soft);
  color: var(--ui-muted);
  font-size: 10px;
  letter-spacing: .08em;
}

thead th:first-child {
  border-left: 1px solid var(--ui-line);
  border-radius: 11px 0 0 11px;
}

thead th:last-child {
  border-right: 1px solid var(--ui-line);
  border-radius: 0 11px 11px 0;
}

tbody td {
  padding: 14px 12px;
  border-top: 0;
  border-bottom: 1px solid var(--ui-line);
  background: transparent;
  color: var(--ui-ink-soft);
}

tbody tr td:first-child,
tbody tr td:last-child {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

tbody tr:hover td {
  background: #fafbfc;
}

.pill {
  min-height: 27px;
  padding: 4px 9px;
  border-color: var(--ui-line);
  background: var(--ui-surface-soft);
  color: var(--ui-ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.pill::before {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  opacity: .72;
}

.pill.done {
  border-color: #cce8d8;
  background: #f1fbf5;
  color: var(--ui-success);
}

.pill.wait,
.pill.review {
  border-color: #efddba;
  background: #fff9ed;
  color: var(--ui-warning);
}

.pill.urgent {
  border-color: #f0cccc;
  background: #fff5f5;
  color: var(--ui-danger);
}

.progress {
  height: 8px;
  background: #e9edf3;
}

.progress span {
  background: linear-gradient(90deg, var(--ui-brand), #7180ff);
}

.flash {
  position: relative;
  padding: 14px 17px 14px 45px;
  border: 1px solid #bfe2cd;
  border-radius: 13px;
  background: #f1fbf5;
  color: #12683a;
  box-shadow: var(--ui-shadow-sm);
}

.flash::before {
  position: absolute;
  top: 50%;
  left: 17px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #16834b;
  color: #fff;
  content: "✓";
  font-size: 11px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
  transform: translateY(-50%);
}

/* Customer portal */

.client-welcome {
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 26px;
  align-items: center;
  margin-bottom: 20px;
  padding: clamp(26px, 3.2vw, 38px);
  border: 1px solid #282f42;
  border-radius: var(--ui-radius-xl);
  background:
    radial-gradient(circle at 82% 5%, rgba(83, 102, 255, .3), transparent 20rem),
    linear-gradient(135deg, #10141d, #192033);
  box-shadow: var(--ui-shadow-md);
}

.client-welcome h1 {
  max-width: 720px;
  margin: 10px 0 10px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1;
}

.client-welcome p {
  max-width: 680px;
  color: rgba(255, 255, 255, .66);
  font-size: 15px;
  line-height: 1.6;
}

.client-welcome .eyebrow {
  color: #9ca8ff;
}

.client-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 9px;
  margin-top: 20px;
}

.client-quick-actions .primary,
.client-quick-actions .soft-button {
  min-height: 38px;
  justify-content: center;
  padding: 9px 13px;
  font-size: 12px;
}

.client-quick-actions .soft-button {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .84);
}

.client-progress {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .16);
}

.client-progress strong {
  margin: 3px 0;
  font-size: 38px;
}

.client-priority-grid {
  grid-template-columns: minmax(280px, .7fr) minmax(0, 1.3fr);
  gap: 18px;
  margin-bottom: 18px;
}

.priority-card {
  border-color: var(--ui-line) !important;
}

.action-row,
.portal-action-card,
.customer-project-card,
.phase-roadmap-item {
  border-color: var(--ui-line);
  border-radius: 14px;
  background: var(--ui-surface-soft);
  box-shadow: none;
  transition:
    transform 150ms var(--ui-ease-out),
    border-color 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease;
}

.action-row:hover,
.portal-action-card:hover,
.customer-project-card:hover,
.phase-roadmap-item:hover {
  border-color: #aeb6c4;
  background: #fff;
  box-shadow: var(--ui-shadow-sm);
}

.client-overview-strip {
  gap: 10px;
  margin-bottom: 20px;
}

.client-overview-strip div {
  padding: 15px;
}

.client-overview-strip span {
  color: var(--ui-muted);
  font-size: 10px;
}

.client-overview-strip strong {
  margin-top: 2px;
  font-size: 25px;
}

/* Affiliate portal */

.affiliate-hero {
  grid-template-columns: minmax(0, 1fr) 230px;
  align-items: center;
  min-height: 0;
  padding: clamp(28px, 3.4vw, 40px);
  border: 1px solid #293044;
  border-radius: var(--ui-radius-xl);
  background:
    radial-gradient(circle at 86% 10%, rgba(91, 109, 255, .32), transparent 20rem),
    linear-gradient(135deg, #11151f, #1c2335);
  color: #fff;
  box-shadow: var(--ui-shadow-md);
}

.affiliate-hero h1,
.affiliate-hero h2,
.affiliate-hero strong {
  color: #fff;
}

.affiliate-hero p,
.affiliate-hero small {
  color: rgba(255, 255, 255, .64);
}

.affiliate-hero .eyebrow {
  color: #aab3ff;
}

.affiliate-hero > .client-progress {
  color: var(--ui-ink);
}

.affiliate-hero > .client-progress span,
.affiliate-hero > .client-progress strong {
  color: var(--ui-ink);
}

.affiliate-hero > .client-progress small {
  color: var(--ui-muted);
}

.affiliate-hero .primary {
  border-color: #fff;
  background: #fff;
  color: var(--ui-ink);
  box-shadow: none;
}

.affiliate-admin-metrics,
.affiliate-admin-stats {
  gap: 12px;
}

/* Feature surfaces */

.modal-backdrop {
  background: rgba(11, 14, 20, .5);
  backdrop-filter: blur(8px);
}

.modal-panel {
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 20px;
  box-shadow: 0 32px 100px rgba(8, 12, 20, .3);
}

.modal-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--ui-line);
}

.modal-head h2 {
  font-size: 19px;
}

.modal-close {
  width: 38px;
  height: 38px;
  border-color: var(--ui-line);
  background: var(--ui-surface-soft);
}

.calendar-shell,
.chat-shell,
.website-preview-shell {
  border-color: var(--ui-line);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
}

.chat-shell {
  height: calc(100dvh - 64px);
}

.chat-thread.active {
  background: linear-gradient(135deg, var(--ui-brand), var(--ui-brand-dark));
  border-color: var(--ui-brand);
  box-shadow: 0 12px 26px rgba(52, 72, 240, .2);
}

.chat-message-row.from-user .chat-bubble {
  background: linear-gradient(135deg, var(--ui-brand), var(--ui-brand-dark));
  border-color: var(--ui-brand);
}

.website-preview-shell {
  background: #0e1117;
}

.website-preview-toolbar {
  min-height: 62px;
}

.website-device-switcher {
  background: var(--ui-surface-strong);
}

.website-device-switcher button.active {
  color: var(--ui-brand-dark);
}

.invoice-policy-note,
.security-note,
.approval-box {
  border-radius: 14px;
}

.readiness-card {
  background: linear-gradient(145deg, #fff, #f6f8ff);
}

.readiness-score {
  border-radius: 18px;
  background: linear-gradient(135deg, var(--ui-brand), var(--ui-brand-dark));
  box-shadow: 0 10px 24px rgba(52, 72, 240, .2);
}

/* Responsive */

@media (hover: hover) and (pointer: fine) {
  .primary:hover,
  .secondary:hover,
  .soft-button:hover,
  .icon-btn:hover,
  .add-action:hover {
    transform: translateY(-1px);
  }

  .nav a.nav-item:hover {
    transform: translateX(2px);
  }

  .action-row:hover,
  .portal-action-card:hover,
  .customer-project-card:hover,
  .phase-roadmap-item:hover {
    transform: translateY(-1px);
  }
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 244px minmax(0, 1fr);
  }

  .role-admin.page-dashboard .topbar {
    grid-template-columns: 1fr;
  }

  .role-admin.page-dashboard .stat-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .client-welcome,
  .affiliate-hero {
    grid-template-columns: minmax(0, 1fr) 220px;
  }
}

@media (max-width: 900px) {
  body {
    background: var(--ui-bg);
  }

  .app {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    max-height: 100dvh;
    padding: 10px 12px;
    gap: 0;
    overflow: visible;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 10px 30px rgba(10, 13, 19, .16);
  }

  .sidebar-head {
    min-height: 52px;
  }

  .brand {
    min-height: 44px;
    padding: 7px 10px;
    border-radius: 11px;
  }

  .brand img {
    width: 146px;
    max-height: 28px;
  }

  .nav-toggle {
    display: block;
  }

  .sidebar.nav-open .nav-toggle > span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .sidebar.nav-open .nav-toggle > span:nth-child(2) {
    opacity: 0;
  }

  .sidebar.nav-open .nav-toggle > span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .nav {
    display: none;
    max-height: calc(100dvh - 146px);
    margin-top: 10px;
    padding: 7px 2px 12px;
    overflow: auto;
    border-top: 1px solid rgba(255, 255, 255, .09);
  }

  .sidebar.nav-open .nav {
    display: block;
  }

  .nav-group {
    margin-top: 12px;
  }

  .nav a.nav-item {
    min-height: 43px;
    padding: 10px 11px;
    background: transparent;
  }

  .sidebar .profile {
    display: none;
    margin-top: 6px;
  }

  .sidebar.nav-open .profile {
    display: grid;
  }

  .main {
    padding: 24px 16px 46px;
  }

  .topbar,
  .role-admin.page-dashboard .topbar {
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
  }

  .role-admin.page-dashboard .topbar {
    padding: 24px;
  }

  .role-admin.page-dashboard .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar h1 {
    font-size: clamp(30px, 7vw, 40px);
  }

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

  .card-head {
    display: flex;
    flex-wrap: wrap;
  }

  .card-head .primary,
  .card-head .soft-button,
  .card-head .icon-btn,
  .card-head .add-action {
    width: auto;
  }

  .client-welcome,
  .affiliate-hero,
  .client-priority-grid {
    grid-template-columns: 1fr;
  }

  .client-progress {
    max-width: none;
  }

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

  .client-overview-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  .actions,
  .file-actions,
  .inline-actions {
    margin-top: 0;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 18px 11px 38px;
  }

  .topbar h1 {
    font-size: 29px;
  }

  .topbar p {
    font-size: 13px;
  }

  .role-admin.page-dashboard .topbar,
  .client-welcome,
  .affiliate-hero {
    padding: 21px;
    border-radius: 19px;
  }

  .role-admin.page-dashboard .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .role-admin.page-dashboard .stat {
    padding: 13px;
  }

  .client-welcome h1 {
    font-size: 34px;
  }

  .client-quick-actions,
  .client-overview-strip {
    grid-template-columns: 1fr;
  }

  .client-quick-actions .primary,
  .client-quick-actions .soft-button {
    width: 100%;
  }

  .client-overview-strip {
    gap: 8px;
  }

  .client-overview-strip div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .client-overview-strip strong {
    margin: 0;
  }

  .card {
    padding: 17px;
  }

  .card h2 {
    font-size: 18px;
  }

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

  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .primary,
  .secondary,
  .soft-button,
  .icon-btn,
  .add-action {
    min-height: 44px;
  }

  .top-actions,
  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .top-actions > *,
  .toolbar-actions > * {
    width: 100%;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-panel {
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
  }

  .chat-shell {
    min-height: calc(100dvh - 88px);
    border-radius: 15px;
  }

  .website-preview-stage {
    padding: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link,
  .nav-toggle > span,
  .nav a.nav-item,
  .primary,
  .secondary,
  .soft-button,
  .icon-btn,
  .add-action,
  .round-plus,
  .slot-button,
  .action-row,
  .portal-action-card,
  .customer-project-card,
  .phase-roadmap-item {
    transition-duration: 0ms !important;
  }

  .primary:active,
  .secondary:active,
  .soft-button:active,
  .icon-btn:active,
  .add-action:active,
  .round-plus:active,
  .slot-button:active,
  .nav-item:active {
    transform: none !important;
  }
}
