:root {
  --canvas: #f2f4ef;
  --surface: #ffffff;
  --surface-soft: #f7f8f5;
  --ink: #17231e;
  --ink-soft: #68736d;
  --line: #dfe5df;
  --green: #2d6c57;
  --green-deep: #1f4d3f;
  --green-soft: #e4f0ea;
  --amber: #b57220;
  --amber-soft: #fff0d7;
  --red: #b14b45;
  --red-soft: #fae8e5;
  --blue: #3f658c;
  --blue-soft: #e9f0f7;
  --shadow-sm: 0 1px 2px rgba(22, 35, 29, .04), 0 8px 24px rgba(22, 35, 29, .04);
  --shadow-lg: 0 18px 55px rgba(22, 35, 29, .12);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; width: 246px; flex-direction: column; padding: 24px 16px; color: #eaf3ee; background: #182a23; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-mark { display: grid; width: 39px; height: 39px; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 12px; color: white; background: linear-gradient(145deg, #4d9478, #2d6c57); font-size: 12px; font-weight: 800; letter-spacing: .08em; box-shadow: 0 8px 22px rgba(0,0,0,.2); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand span { margin-top: 1px; color: #92a79d; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav-item { position: relative; display: flex; min-height: 44px; align-items: center; gap: 12px; padding: 8px 11px; border-radius: 11px; color: #aebeb6; font-weight: 600; transition: background .18s, color .18s, transform .18s; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); transform: translateX(1px); }
.nav-item.active { color: white; background: rgba(105, 177, 145, .16); box-shadow: inset 3px 0 0 #68ad8e; }
.nav-glyph { display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid rgba(255,255,255,.11); border-radius: 8px; color: #c8d5ce; font-size: 10px; font-weight: 800; }
.nav-count { margin-left: auto; min-width: 24px; padding: 2px 7px; border-radius: 99px; color: #d3e5dc; background: rgba(255,255,255,.08); font-size: 11px; text-align: center; }
.nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: #e8aa54; box-shadow: 0 0 0 4px rgba(232,170,84,.12); }
.sidebar-footer { display: grid; gap: 14px; margin-top: auto; }
.storage-card { padding: 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(255,255,255,.045); }
.storage-heading { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700; }
.status-live { color: #81c7a7; }
.storage-card small { color: #8ea299; font-size: 10px; }
.progress { overflow: hidden; height: 5px; margin: 11px 0 8px; border-radius: 99px; background: rgba(255,255,255,.09); }
.progress span { display: block; height: 100%; border-radius: inherit; background: #61a486; }

.main { min-height: 100vh; margin-left: 246px; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; min-height: 80px; align-items: center; gap: 24px; padding: 12px 30px; border-bottom: 1px solid rgba(213,220,214,.9); background: rgba(247,248,245,.9); backdrop-filter: blur(18px); }
.topbar-title { min-width: 230px; }
.topbar-title h1 { margin: 2px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 20px; line-height: 1.2; font-weight: 600; letter-spacing: -.015em; }
.eyebrow { color: var(--ink-soft); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.search-box { display: flex; width: min(32vw, 360px); height: 42px; align-items: center; gap: 8px; padding: 0 10px 0 13px; border: 1px solid var(--line); border-radius: 12px; color: #849089; background: white; box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.search-box > span { font-size: 11px; font-weight: 800; text-transform: uppercase; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-box input::placeholder { color: #9ba49f; }
kbd { padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: #75807a; background: #f7f8f6; font-size: 10px; }
.icon-button { position: relative; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink-soft); background: white; cursor: pointer; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.notification-ping { position: absolute; top: -6px; right: -5px; display: grid; width: 18px; height: 18px; place-items: center; border: 2px solid var(--canvas); border-radius: 50%; color: white; background: var(--red); font-size: 9px; }
.profile-chip { display: flex; align-items: center; gap: 9px; padding-left: 4px; }
.profile-chip strong, .profile-chip small { display: block; }
.profile-chip strong { font-size: 12px; }
.profile-chip small { color: var(--ink-soft); font-size: 10px; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: white; background: var(--green); font-size: 11px; font-weight: 800; }
.mobile-menu { display: none; }

.content { max-width: 1500px; margin: 0 auto; padding: 30px; }
.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.hero-row h2 { margin: 3px 0 4px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(28px, 3vw, 42px); line-height: 1.08; font-weight: 500; letter-spacing: -.035em; }
.section-kicker { margin: 0; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { margin: 0; color: var(--ink-soft); }
.button { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; padding: 0 17px; border-radius: 11px; font-weight: 750; box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s; }
.button:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.button.primary { color: white; background: var(--green); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { position: relative; overflow: hidden; min-height: 145px; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-card::after { position: absolute; right: -28px; bottom: -35px; width: 110px; height: 110px; border-radius: 50%; background: var(--metric-soft); content: ""; }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.metric-tag { padding: 4px 8px; border-radius: 99px; color: var(--metric); background: var(--metric-soft); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.metric-number { position: relative; z-index: 1; display: block; margin-top: 13px; font-family: Georgia, "Times New Roman", serif; font-size: 40px; line-height: 1; font-weight: 500; }
.metric-note { position: relative; z-index: 1; display: block; margin-top: 8px; color: var(--ink-soft); font-size: 11px; }
.tone-green { --metric: var(--green); --metric-soft: var(--green-soft); }
.tone-amber { --metric: var(--amber); --metric-soft: var(--amber-soft); }
.tone-red { --metric: var(--red); --metric-soft: var(--red-soft); }
.tone-blue { --metric: var(--blue); --metric-soft: var(--blue-soft); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, .75fr); gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 19px 20px 16px; }
.panel-heading h3 { margin: 3px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 20px; line-height: 1.2; font-weight: 600; }
.text-link { color: var(--green); font-size: 11px; font-weight: 800; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 11px 17px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #7c8881; background: var(--surface-soft); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 15px 17px; border-bottom: 1px solid #edf0ed; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: #fbfcfa; }
.job-name, .data-table td > strong { display: block; font-size: 12px; font-weight: 760; }
.job-name:hover { color: var(--green); }
.job-code, .editor-line, .deadline { display: flex; align-items: center; gap: 5px; margin-top: 4px; color: #849089; font-size: 10px; white-space: nowrap; }
.mini-avatar { display: inline-grid; width: 19px; height: 19px; place-items: center; border-radius: 6px; color: var(--green-deep); background: var(--green-soft); font-size: 7px; font-weight: 800; }
.deadline.urgent { color: var(--red); }
.status { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 99px; font-size: 9px; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.status-editing { color: var(--blue); background: var(--blue-soft); }
.status-revision { color: var(--amber); background: var(--amber-soft); }
.status-assigned { color: var(--green); background: var(--green-soft); }
.status-delivered { color: #4c6d49; background: #edf5e9; }
.status-on-hold { color: #6d6870; background: #efedf0; }
.row-action { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-soft); background: white; cursor: pointer; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.side-stack { display: grid; gap: 18px; }
.compact-panel { padding-bottom: 18px; }
.payment-amount { margin: 0 20px; padding: 18px; border-radius: 14px; color: white; background: linear-gradient(135deg, #234c3e, #3d8067); }
.payment-amount span, .payment-amount strong { display: block; }
.payment-amount span { color: #cce1d6; font-size: 11px; }
.payment-amount strong { margin-top: 5px; font-family: Georgia, "Times New Roman", serif; font-size: 28px; font-weight: 500; }
.payment-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 20px 0; }
.payment-split div { display: grid; gap: 3px; }
.payment-split span { color: var(--ink-soft); font-size: 10px; }
.payment-split strong { font-size: 13px; }
.payment-split .positive { color: var(--green); }
.payment-progress { margin: 16px 20px 8px; background: #e9ede9; }
.caption { margin: 0 20px; color: #87918c; font-size: 10px; }
.activity-list { display: grid; gap: 0; margin: 0; padding: 0 20px; list-style: none; }
.activity-list li { position: relative; display: grid; grid-template-columns: 13px 1fr; gap: 11px; padding: 3px 0 15px; }
.activity-list li:not(:last-child)::before { position: absolute; top: 15px; bottom: 0; left: 5px; width: 1px; background: var(--line); content: ""; }
.activity-mark { z-index: 1; width: 11px; height: 11px; margin-top: 4px; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.activity-mark.green { background: var(--green); }
.activity-mark.amber { background: var(--amber); }
.activity-mark.blue { background: var(--blue); }
.activity-list strong { display: block; font-size: 11px; }
.activity-list p { margin: 2px 0; color: var(--ink-soft); font-size: 10px; }
.activity-list time { color: #9aa39e; font-size: 9px; }
.sidebar-backdrop { display: none; }

/* Forms and application pages */
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-heading h2 { margin: 2px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 32px; font-weight: 500; letter-spacing: -.025em; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button.secondary { border: 1px solid var(--line); color: var(--ink); background: white; }
.button.danger { color: white; background: var(--red); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: var(--shadow-sm); }
.field { display: grid; gap: 6px; }
.field.grow { min-width: 220px; flex: 1; }
.field label { color: #69766f; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.input, .select, .textarea { width: 100%; border: 1px solid #d8ded9; border-radius: 10px; outline: 0; color: var(--ink); background: white; transition: border-color .16s, box-shadow .16s; }
.input, .select { height: 42px; padding: 0 12px; }
.textarea { min-height: 100px; padding: 11px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: #78a792; box-shadow: 0 0 0 3px rgba(45,108,87,.11); }
.form-card { padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { margin: 0 0 20px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.form-section h3 { margin: 0 0 3px; font-family: Georgia, "Times New Roman", serif; font-size: 19px; }
.form-section p { margin: 0; color: var(--ink-soft); font-size: 11px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.flash { margin-bottom: 16px; padding: 12px 14px; border: 1px solid #bee0cf; border-radius: 11px; color: #23523f; background: #eaf6f0; }
.flash.error { border-color: #e7beb9; color: #842f2a; background: #fbedeb; }
.empty-state { padding: 50px 20px; color: var(--ink-soft); text-align: center; }
.pagination { display: flex; justify-content: flex-end; gap: 5px; padding: 15px 18px; border-top: 1px solid var(--line); }
.pagination a { display: grid; min-width: 32px; height: 32px; place-items: center; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; }
.pagination a.active { border-color: var(--green); color: white; background: var(--green); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 18px; }
.detail-stack { display: grid; gap: 18px; align-content: start; }
.key-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--line); }
.key-values div { min-height: 76px; padding: 14px; background: white; }
.key-values span, .key-values strong { display: block; }
.key-values span { margin-bottom: 4px; color: var(--ink-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.key-values strong { font-size: 12px; }
.tabs { display: flex; gap: 3px; padding: 6px; border-bottom: 1px solid var(--line); }
.tab { padding: 8px 12px; border-radius: 9px; color: var(--ink-soft); font-size: 11px; font-weight: 750; }
.tab.active { color: var(--green-deep); background: var(--green-soft); }
.login-page { display: grid; min-height: 100vh; grid-template-columns: minmax(320px, 1fr) minmax(420px, .8fr); background: #182a23; }
.login-story { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(32px, 7vw, 90px); color: white; background: radial-gradient(circle at 15% 15%, rgba(90,157,126,.25), transparent 34%), #182a23; }
.login-story h1 { max-width: 650px; margin: 40px 0 15px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(45px, 6vw, 78px); line-height: .98; font-weight: 500; letter-spacing: -.055em; }
.login-story p { max-width: 520px; color: #b9cbc2; font-size: 16px; }
.login-form-wrap { display: grid; place-items: center; padding: 30px; background: var(--canvas); }
.login-card { width: min(100%, 430px); padding: 32px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow-lg); }
.login-card h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 500; }
.login-card > p { margin: 5px 0 24px; color: var(--ink-soft); }
.login-card .field { margin-bottom: 15px; }
.login-card .button { width: 100%; border: 0; }
.logout-button { width: 100%; border: 0; cursor: pointer; text-align: left; }
.service-form-list { display: grid; gap: 10px; }
.service-form-row { display: grid; grid-template-columns: minmax(180px,1.5fr) 100px 140px minmax(190px,1fr) auto; gap: 10px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.service-form-row .remove-service { height: 42px; }
.inline-details { margin-top: 6px; }
.inline-details summary, .add-section summary { color: var(--green); cursor: pointer; font-size: 10px; font-weight: 800; list-style: none; }
.inline-details summary::-webkit-details-marker, .add-section summary::-webkit-details-marker { display: none; }
.mini-form { display: grid; gap: 9px; margin-top: 11px; }
.inline-details .mini-form { min-width: 260px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); box-shadow: var(--shadow-lg); }
.mini-form.horizontal { grid-template-columns: minmax(160px,1.5fr) 80px 120px minmax(180px,1fr) auto; align-items: end; }
.add-section { padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.add-section[open] > summary { margin-bottom: 13px; }
.compact-select { min-width: 125px; height: 35px; padding: 0 8px; font-size: 10px; font-weight: 750; }
.path-preview { overflow: hidden; max-width: 220px; text-overflow: ellipsis; }
.revision-item-row { display: grid; grid-template-columns: 130px 1fr; gap: 9px; margin: 10px 0; }
.payment-history { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.payment-history strong, .payment-history span { display: block; }
.payment-history span { color: var(--ink-soft); font-size: 9px; }
.payment-history.is-void { opacity: .55; text-decoration: line-through; }
.revision-checklist { display: grid; }
.revision-check { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.revision-check > button { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: white; background: white; cursor: pointer; font-weight: 900; }
.revision-check.done > button { border-color: var(--green); background: var(--green); }
.revision-check strong { font-size: 11px; }
.revision-check p { margin: 2px 0 0; color: var(--ink-soft); }
.revision-check.done p { text-decoration: line-through; opacity: .65; }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-box { width: 250px; }
  .profile-chip > span:last-child { display: none; }
}

@media (max-width: 820px) {
  .sidebar { transform: translateX(-105%); box-shadow: var(--shadow-lg); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(9,20,15,.45); backdrop-filter: blur(2px); }
  .sidebar-backdrop.show { display: block; }
  .main { margin-left: 0; }
  .mobile-menu { display: block; }
  .topbar { min-height: 68px; padding: 10px 16px; }
  .topbar-title h1, .eyebrow { display: none; }
  .topbar-title { min-width: 0; }
  .search-box { width: min(45vw, 280px); }
  .search-box > span, kbd { display: none; }
  .content { padding: 22px 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .service-form-row { grid-template-columns: 1fr 1fr; }
  .service-form-row .field:first-child { grid-column: 1 / -1; }
  .mini-form.horizontal { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .hero-row, .page-heading { align-items: stretch; flex-direction: column; }
  .hero-row .button { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 124px; padding: 15px; }
  .metric-number { font-size: 34px; }
  .metric-note { font-size: 10px; }
  .side-stack { grid-template-columns: 1fr; }
  .search-box { display: none; }
  .topbar-actions { gap: 7px; }
  .profile-chip { padding: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .key-values { grid-template-columns: 1fr 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-form-wrap { padding: 18px; }
  .login-card { padding: 24px; }
  .service-form-row, .mini-form.horizontal, .revision-item-row { grid-template-columns: 1fr; }
  .service-form-row .field:first-child { grid-column: auto; }
  .revision-check { grid-template-columns: 32px 1fr; }
  .revision-check > .status { grid-column: 2; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
