:root {
  --page: #eef0f5;
  --card: #fff;
  --tile: #fff;
  --text: #15161a;
  --muted: #7d828c;
  --line: #e9ebf0;
  --brand: #d9121f;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 2px 8px rgba(20, 24, 40, .05);
  --ico-alpha: 1;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0f1014; --card: #191b21; --tile: #20232b; --text: #f1f2f5; --muted: #9499a5;
    --line: #2a2d37; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --ico-alpha: .16;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0f1014; --card: #191b21; --tile: #20232b; --text: #f1f2f5; --muted: #9499a5;
  --line: #2a2d37; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --ico-alpha: .16;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(300px, 26%);
  gap: 20px;
  padding: 16px 18px 16px 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid #5b6cff; outline-offset: 2px; }
[hidden] { display: none !important; }

/* Sidebar */
.side {
  position: sticky; top: 16px;
  height: calc(100vh - 32px);
  width: 86px;
  display: flex; flex-direction: column; align-items: center;
  transition: width .2s;
}
.logo, .avatar {
  display: grid; place-content: center; text-align: center;
  background: var(--brand); color: #fff;
  font-weight: 900; letter-spacing: -.02em; line-height: .95;
}
.logo { width: 54px; height: 54px; border-radius: 9px; font-size: 13px; margin-bottom: 30px; flex: none; }
.logo span, .avatar span { display: block; font-size: .62em; font-weight: 700; text-align: right; }
.side-nav { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 6px; padding: 6px 0; width: 100%; align-items: center; }
.side-nav::-webkit-scrollbar { display: none; }
.side-nav li { width: calc(100% - 34px); }
.side-nav a, .side-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 52px; height: 52px; margin: 0 auto; border-radius: 14px; color: var(--muted);
}
.side-nav a span { display: none; white-space: nowrap; font-weight: 500; }
.side-nav a:hover, .side-btn:hover { color: var(--text); }
.side-nav a.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.side-foot { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; }
.side-btn.round { width: 46px; height: 46px; border-radius: 50%; background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.side-btn svg { transition: transform .2s; }
.side.open { width: 210px; }
.side.open .side-nav a { width: 100%; justify-content: flex-start; padding: 0 15px; }
.side.open .side-nav a span { display: inline; }
.side.open #expandBtn svg { transform: rotate(180deg); }

/* Main cards */
.main { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.card { background: var(--card); border-radius: 22px; padding: 22px 22px 24px; }
.date { font-size: 17px; font-weight: 500; }
.hello { display: flex; align-items: center; gap: 26px; margin: 46px 0 50px; }
.avatar { width: 90px; height: 90px; border-radius: 50%; font-size: 24px; flex: none; }
h1 { font-size: 35px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
.sun {
  display: inline-block; width: .95em; height: .95em; vertical-align: -.12em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg stroke='%23f6b21b' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M16 2v4M16 26v4M2 16h4M26 16h4M6 6l3 3M23 23l3 3M26 6l-3 3M9 23l-3 3'/%3E%3C/g%3E%3Ccircle cx='16' cy='16' r='8' fill='%23ffc928'/%3E%3C/svg%3E") center/contain no-repeat;
}
.sub { color: var(--muted); font-size: 17px; margin-top: 12px; }
.row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
h2 { font-size: 15px; font-weight: 500; }
h2.big { font-size: 17px; }
.muted, .link-btn { color: var(--muted); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; }
.link-btn svg { width: 17px; height: 17px; }
.muted:hover, .link-btn:hover { color: var(--text); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 12px; }
.tile {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 68px; padding: 12px; border-radius: 14px; text-align: left;
  background: var(--tile); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-weight: 600; font-size: 16px;
  transition: transform .12s, box-shadow .12s;
}
.tile:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(20, 24, 40, .1); }
.tile .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.off { opacity: .45; }
.ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-content: center; flex: none; background: color-mix(in srgb, currentColor calc(var(--ico-alpha) * 13%), transparent); }
.c-violet { color: #6b5bf0; } .c-red { color: #ef4444; } .c-orange { color: #f08a24; }
.c-green { color: #22a55b; } .c-lime { color: #4d9f2d; } .c-sky { color: #2c8fe8; }
.c-teal { color: #14a8a0; } .c-yellow { color: #e2a400; } .c-blue { color: #3b6cf2; } .c-grey { color: #8a8f99; }
.tile .label { color: var(--text); }
.badge { font-size: 12px; font-weight: 700; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); padding: 2px 8px; border-radius: 99px; }
.badge.plain { color: var(--muted); background: var(--page); }

/* Hub list */
.news li + li { border-top: 1px solid var(--line); }
.news a { display: flex; align-items: center; gap: 16px; padding: 8px 0; }
.news li:first-child a { padding-top: 0; }
.news li:last-child a { padding-bottom: 0; }
.news strong { display: block; font-weight: 600; font-size: 16px; }
.news a:hover strong { text-decoration: underline; }
.meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin-top: 2px; }
.meta i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.dot { color: #1c9c53; font-weight: 600; }
.dot::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 2px; }
.thumb {
  width: 106px; height: 60px; border-radius: 8px; flex: none; padding: 7px 9px;
  color: #fff; font-weight: 900; font-size: 13px; line-height: 1.05; overflow: hidden;
}
.t-blue { background: linear-gradient(135deg, #2d7df6, #7fb6ff); }
.t-dark { background: linear-gradient(135deg, #101418, #24443a); color: #d6f24a; font-size: 16px; }
.t-navy { background: linear-gradient(135deg, #0d1b3a 55%, #2f7df4 55%); }

.empty { text-align: center; padding-bottom: 90px; }
.empty .muted { display: block; text-align: left; }
.empty-icon { width: 76px; height: 76px; margin: 70px auto 22px; border-radius: 22px; display: grid; place-content: center; background: var(--page); color: var(--muted); }
.empty-icon svg { width: 34px; height: 34px; }

/* Feature panel */
.feature {
  position: sticky; top: 16px; height: calc(100vh - 32px); min-height: 520px;
  border-radius: 22px; overflow: hidden; color: #fff;
  background: radial-gradient(120% 60% at 50% 45%, #55597a 0%, #2a2c3d 45%, #14151c 100%);
  display: flex; flex-direction: column;
}
.feature header { display: flex; justify-content: space-between; padding: 20px 18px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.stack { flex: 1; position: relative; display: grid; place-items: center; min-height: 0; }
.cover { position: absolute; width: 74%; aspect-ratio: 3 / 4; max-height: 86%; border-radius: 3px; box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
.back-l { background: linear-gradient(160deg, #6f93c9, #c9d6ea); transform: translateX(-17%) rotate(-5deg) scale(.9); }
.back-r { background: linear-gradient(160deg, #e9c53a, #d63a2a 60%); transform: translateX(15%) rotate(5deg) scale(.92); }
.front {
  background: radial-gradient(90% 50% at 50% 62%, #8fd0d6 0%, #2f5d74 38%, #131b2e 75%);
  transform: rotate(-1.5deg); padding: 7% 7% 6%;
  display: flex; flex-direction: column; overflow: hidden; container-type: inline-size;
}
.tag { position: absolute; top: 3%; left: 4%; background: var(--brand); font-size: 3cqw; font-weight: 900; padding: 1px 4px; border-radius: 2px; }
.issue { position: absolute; top: 3%; right: 5%; background: var(--brand); font-size: 2.6cqw; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 1px 6px; }
.mast { font: 400 14cqw/1 Georgia, "Times New Roman", serif; letter-spacing: .08em; text-align: center; margin-top: 7%; }
.script { font: italic 400 13cqw/1.05 "Snell Roundhand", "Apple Chancery", "Brush Script MT", cursive; text-align: center; margin-top: 9%; color: #eaf3ff; }
.orb { flex: 1; }
.cover-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 6%; border-top: 1px solid rgba(255, 255, 255, .35); padding-top: 4%; }
.hand { font: italic 7.5cqw/1.1 "Snell Roundhand", "Apple Chancery", cursive; }
.small { font-size: 2.7cqw; letter-spacing: .08em; color: #f2c59b; line-height: 1.3; }
.small b { color: #fff; font-size: 3.4cqw; letter-spacing: 0; }
.feature footer { padding: 18px 18px 22px; display: flex; flex-direction: column; }
.feature footer strong { font-size: 20px; }
.feature footer span { color: #c5c8d4; font-size: 14px; }

.toast {
  position: absolute; left: 20%; right: 10px; bottom: 10px;
  display: flex; gap: 12px; padding: 18px 16px;
  background: var(--card); color: var(--text); border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.toast-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--page); display: grid; place-content: center; flex: none; }
.toast-icon svg { width: 18px; height: 18px; }
.toast strong { font-size: 15px; display: block; padding-right: 18px; }
.toast p { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.toast-actions { display: flex; gap: 8px; }
.btn { padding: 7px 12px; border-radius: 9px; border: 1px solid var(--line); font-weight: 600; font-size: 14px; background: var(--tile); }
.btn.dark { background: var(--text); color: var(--card); border-color: var(--text); }
.close { position: absolute; top: 12px; right: 12px; color: var(--muted); }
.close svg { width: 15px; height: 15px; }

/* Built sections */
body.wide { grid-template-columns: auto minmax(0, 1fr); }
body.wide .feature { display: none; }
.app-view { padding: 26px 26px 30px; min-height: calc(100vh - 32px); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 30px; }
.page-head .sub { font-size: 15px; margin-top: 6px; }
.btn { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.btn svg, .muted svg { width: 16px; height: 16px; }
.btn.on { background: color-mix(in srgb, var(--brand) 10%, var(--tile)); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); color: var(--brand); }
.btn.on svg { fill: currentColor; }
.icon-btn { color: var(--muted); padding: 6px; border-radius: 8px; }
.icon-btn:hover { color: var(--brand); background: var(--page); }
.quiet { color: var(--muted); padding: 26px 0; }
.fine { color: var(--muted); font-size: 13px; margin-top: 26px; max-width: 80ch; }
.t-co { background: linear-gradient(135deg, #2b2e45, #5b6cff); display: grid; place-content: center; text-align: center; font-size: 12px; font-weight: 700; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--tile);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-width: 0;
}
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
.searchbar { display: flex; align-items: center; gap: 10px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--tile); box-shadow: var(--shadow); color: var(--muted); }
.searchbar input { flex: 1; border: 0; background: none; padding: 12px 0; font-size: 17px; outline: none; }
.searchbar:focus-within { outline: 2px solid #5b6cff; outline-offset: 2px; }
.understood { color: var(--muted); font-size: 14px; margin-top: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 18px 0 6px; }
.filters label.tick, .radio { flex-direction: row; align-items: center; gap: 7px; color: var(--text); font-size: 14px; padding-bottom: 9px; }
.count { font-weight: 600; margin: 18px 0 4px; }
.jobs > li.job { display: flex; gap: 20px; justify-content: space-between; padding: 18px 0; border-top: 1px solid var(--line); }
.job-main { min-width: 0; }
.job h3 { margin: 0 0 3px; font-size: 18px; font-weight: 600; }
.job h3 a:hover { text-decoration: underline; }
.job p { color: var(--muted); font-size: 14px; margin-top: 9px; max-width: 90ch; }
.job-side { display: flex; flex-direction: column; gap: 8px; align-items: stretch; flex: none; }
.job-side .btn { justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip { font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--page); color: var(--muted); }
.chip.good { color: #17804a; background: color-mix(in srgb, #22a55b 14%, transparent); }
.chip.warn { color: #b25e09; background: color-mix(in srgb, #f08a24 16%, transparent); }
#more { padding-top: 14px; border-top: 1px solid var(--line); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stats div { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--tile); box-shadow: var(--shadow); }
.stats span { display: block; color: var(--muted); font-size: 13px; }
.stats strong { font-size: 26px; font-weight: 600; }
.add { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.add input { flex: 1 1 170px; }
.app { border-top: 1px solid var(--line); padding: 18px 0; }
.app-top { display: flex; justify-content: space-between; gap: 12px; }
.app-top strong { font-size: 17px; font-weight: 600; }
.app-fields { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin: 12px 0; }
.app-fields .muted { display: inline-flex; align-items: center; gap: 6px; padding-bottom: 10px; font-size: 14px; }
.app-fields .chip { margin-bottom: 9px; }
.notes textarea { resize: vertical; width: 100%; max-width: 760px; }

.pay-form { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-end; margin-bottom: 22px; }
.pay-form input#payAmount { font-size: 22px; font-weight: 600; width: 220px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 16px; flex-wrap: wrap; }
legend { font-size: 13px; color: var(--muted); font-weight: 500; padding: 0 0 6px; }
.table-wrap { overflow-x: auto; }
.pay-table { border-collapse: collapse; width: 100%; max-width: 760px; font-variant-numeric: tabular-nums; }
.pay-table th, .pay-table td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pay-table th:first-child { text-align: left; font-weight: 500; }
.pay-table thead th { color: var(--muted); font-size: 13px; font-weight: 500; }
.pay-table .total th, .pay-table .total td { font-weight: 700; }

/* Smaller screens: panel moves below, then the menu becomes a top strip */
@media (max-width: 1100px) {
  body { grid-template-columns: auto minmax(0, 1fr); }
  .feature { grid-column: 2; position: relative; top: 0; height: 620px; }
  .toast { left: auto; max-width: 400px; }
}
@media (max-width: 640px) {
  body { display: block; padding: 0 16px 16px; }
  .side { position: static; width: auto; height: auto; flex-direction: row; gap: 8px; padding: 10px 0; }
  .side.open { width: auto; }
  .logo { width: 44px; height: 44px; margin: 0; font-size: 11px; }
  .side-nav { flex-direction: row; min-width: 0; align-items: stretch; justify-content: flex-start; overflow-x: auto; padding: 4px; gap: 2px; }
  .side-nav li { width: auto; }
  .side-nav a { width: 44px; height: 44px; }
  .side-foot { padding: 0; }
  #expandBtn { display: none; }
  .card { padding: 18px 16px; border-radius: 18px; }
  .hello { gap: 16px; margin: 28px 0 32px; }
  .avatar { width: 64px; height: 64px; font-size: 17px; }
  h1 { font-size: 27px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 10px; font-size: 14px; gap: 9px; min-height: 58px; }
  .ico { width: 36px; height: 36px; border-radius: 10px; }
  .tile .badge { display: none; }
  .thumb { width: 84px; height: 50px; }
  .feature { margin-top: 22px; height: 560px; min-height: 0; }
  .toast { left: 10px; }
  .app-view { padding: 18px 16px; min-height: 0; }
  .page-head h1 { font-size: 25px; }
  .jobs > li.job { flex-direction: column; gap: 12px; }
  .job-side { flex-direction: row; }
  .filters label:not(.tick) { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
