@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk.c5e9a9901938.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono.570751c5f8b4.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* Reference palette */
  --paper: #f6f8fc;
  --white: #ffffff;
  --navy: #162238;
  --navy-mid: #263b62;
  --slate: #47566e;
  --slate-mid: #74839c;
  --gray-line: #c9d3e2;
  --gray-wash: #edf2fa;
  --blue: #2259d6;
  --blue-deep: #1947b4;
  --blue-pale: #e8f0ff;
  --blue-light: #a2beff;
  --red-deep: #a02435;
  --red-pale: #fce9ed;
  --green-deep: #20583a;
  --green-pale: #e7f4eb;

  /* Semantic UI roles */
  --bg-app: var(--paper);
  --bg-surface: var(--white);
  --bg-recessed: var(--gray-wash);
  --text-primary: var(--navy);
  --text-secondary: var(--slate);
  --text-inverse: var(--white);
  --border-subtle: var(--gray-line);
  --border-control: var(--slate-mid);
  --accent: var(--blue);
  --accent-hover: var(--blue-deep);
  --accent-soft: var(--blue-pale);
  --focus: var(--blue);
  --nav-bg: var(--navy);
  --nav-selected: var(--navy-mid);
  --nav-indicator: var(--blue-light);
  --danger-text: var(--red-deep);
  --danger-bg: var(--red-pale);
  --success-text: var(--green-deep);
  --success-bg: var(--green-pale);

  --sidebar: 250px;
  --radius: 8px;
  --gutter: clamp(30px, 3.35vw, 54px);
  --font-ui: "Schibsted Grotesk", system-ui, sans-serif;
  --font-date: "JetBrains Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg-app); color: var(--text-primary); font: 400 16px/1.45 var(--font-ui); }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.icon { flex: 0 0 auto; vertical-align: middle; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: 10px; left: 10px; z-index: 3; padding: 9px 12px;
  color: var(--text-primary); background: var(--bg-surface); border-radius: var(--radius);
}

.topbar { background: var(--nav-bg); color: var(--text-inverse); --focus: var(--nav-indicator); }
.topbar-inner { display: flex; align-items: center; gap: 14px; padding: 16px var(--gutter); }
.brand {
  display: inline-flex; align-items: center; gap: 11px; color: var(--text-inverse); text-decoration: none;
  font-size: 23px; letter-spacing: -.045em; font-weight: 750; white-space: nowrap;
}
.brand-mark {
  width: 36px; height: 36px; display: block; flex: 0 0 auto;
  clip-path: inset(4% round 18%);
}
.nav { display: flex; gap: 4px; }
.nav a, .logout button {
  position: relative; display: inline-flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 12px;
  border: 0; border-radius: 6px; text-decoration: none; font-size: 15px; font-weight: 600; color: var(--text-inverse);
  background: transparent; white-space: nowrap;
}
.nav a:hover, .logout button:hover, .nav a[aria-current="page"] { background: var(--nav-selected); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; background: var(--nav-indicator); border-radius: 2px; }
.nav a[aria-current="page"] .icon { color: var(--nav-indicator); }
.logout { margin: 0 0 0 auto; }

.main { width: 100%; max-width: 1360px; margin-inline: auto; padding: 43px var(--gutter) 56px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.page-head h1 { font-size: clamp(36px, 4.35vw, 66px); letter-spacing: -.061em; line-height: 1.03; font-weight: 760; overflow-wrap: anywhere; }
.page-head p { margin-top: 7px; color: var(--text-secondary); font-size: 17px; }
.today-head { margin-bottom: 24px; }
.today-date time { font-family: var(--font-date); font-size: 14px; font-weight: 500; }
.block + .block { margin-top: 28px; }
.block h2 { font-size: clamp(24px, 2.6vw, 33px); letter-spacing: -.045em; font-weight: 730; line-height: 1.14; }
.section-description { margin-top: 3px; color: var(--text-secondary); font-size: 16px; }
.agenda-block { border-top: 1px solid var(--border-subtle); padding-top: 24px; }
.section-heading { display: flex; align-items: center; gap: 14px; }
.section-icon {
  flex: 0 0 auto; width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: var(--radius); color: var(--accent-hover); background: var(--accent-soft);
}
.section-icon .icon { width: 24px; height: 24px; }
.group-label { font-size: 16px; margin-top: 20px; font-weight: 700; }

.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; gap: 7px; padding: 7px 12px;
  border: 1px solid transparent; border-radius: 6px; font-size: 14px; font-weight: 650; line-height: 1.2;
  white-space: nowrap; text-decoration: none; transition: background-color 140ms ease, border-color 140ms ease;
}
.button .icon { width: 17px; height: 17px; }
.primary { color: var(--text-inverse); background: var(--accent); padding-inline: 16px; }
.primary:hover { background: var(--accent-hover); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .65; cursor: default; }
.page-head > .primary { min-height: 49px; padding-inline: 17px; font-size: 16px; }
.page-head > .primary .icon { width: 20px; height: 20px; }
.outline, .neutral { background: var(--bg-surface); }
.outline { color: var(--accent-hover); border-color: var(--accent); }
.neutral { color: var(--text-primary); border-color: var(--border-control); }
.outline:hover { background: var(--accent-soft); }
.neutral:hover { background: var(--bg-recessed); }
.text-link { color: var(--accent-hover); font-weight: 650; text-underline-offset: 3px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.table-frame { border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-surface); overflow: clip; }
.block .table-frame, .block .empty { margin-top: 20px; }
.block .group-label + .table-frame, .block .group-label + .empty { margin-top: 8px; }
table { border-collapse: collapse; width: 100%; }
th {
  text-align: left; padding: 12px 16px; background: var(--bg-recessed); color: var(--text-secondary);
  font-size: 12px; text-transform: uppercase; letter-spacing: .059em; font-weight: 750;
}
td { padding: 13px 16px; overflow-wrap: anywhere; }
tr + tr td, .today-table tbody { border-top: 1px solid var(--border-subtle); }
.today-table :is(th, td) + :is(th, td) { border-left: 1px solid var(--border-subtle); }
.today-table { table-layout: fixed; line-height: 1.35; }
.quote-table .client-col { width: 24%; }
.quote-table .service-col { width: 27%; }
.quote-table .date-col { width: 17%; }
.visit-table .client-col { width: 24%; }
.visit-table .service-col { width: 27%; }
.visit-table .date-col { width: 22%; }
.client-name { display: block; font-size: 1.08em; font-weight: 730; letter-spacing: -.017em; }
.secondary { display: block; margin-top: 2px; color: var(--text-secondary); font-size: .9em; }
.date-status { color: var(--text-primary); white-space: nowrap; }
.date-status time { display: block; font: 500 13px/1.4 var(--font-date); }
.date-status span {
  display: inline-block; margin-top: 4px; padding: 2px 7px; border-radius: 5px;
  font-size: 12px; font-weight: 680; color: var(--accent-hover); background: var(--accent-soft);
}
.date-status.overdue span { color: var(--danger-text); background: var(--danger-bg); }
.empty { display: flex; align-items: flex-start; gap: 12px; padding: 19px; border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-surface); }
.empty-icon { display: grid; place-items: center; width: 31px; height: 31px; flex-shrink: 0; border-radius: 6px; background: var(--accent-soft); color: var(--accent-hover); }
.empty p { color: var(--text-secondary); margin-top: 3px; font-size: 14px; }

.form-panel { max-width: 620px; border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-surface); padding: 26px; }
.field + .field { margin-top: 16px; }
.field label, .details dt { display: block; font-size: 15px; font-weight: 700; }
.field label { margin-bottom: 5px; }
input:not([type="hidden"]), select, textarea {
  width: 100%; min-height: 44px; border: 1px solid var(--border-control); border-radius: 6px;
  padding: 9px 11px; color: var(--text-primary); background: var(--bg-surface); font-size: 16px;
}
textarea { min-height: 90px; resize: vertical; }
.help { margin-top: 4px; color: var(--text-secondary); font-size: 13px; }
.field-invalid :is(input, textarea, select) { border-color: var(--danger-text); }
.errorlist { color: var(--danger-text); font-size: 14px; margin: 6px 0 0; padding-left: 19px; }
.errorlist.nonfield { margin: 0 0 14px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.form-note { margin-bottom: 16px; color: var(--text-secondary); }
.login { max-width: 460px; margin: 12px auto 0; }
.login .page-head { margin-bottom: 22px; }
.login h1 { font-size: clamp(36px, 5vw, 55px); }
.messages { margin-bottom: 18px; }
.messages p {
  display: flex; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid var(--border-subtle); border-radius: 6px;
  color: var(--text-primary); background: var(--bg-surface);
}
.messages .success { color: var(--success-text); background: var(--success-bg); }
.search { display: flex; align-items: center; gap: 9px; max-width: 630px; margin-bottom: 20px; }
.search input { min-width: 0; }
.search .text-link { font-size: 14px; }
.mobile-label { display: none; }
.details { display: grid; gap: 15px; margin: 0; }
.details dd { margin: 3px 0 0; color: var(--text-secondary); overflow-wrap: anywhere; }

@media (min-width: 1120px) {
  .workspace { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .workspace .topbar { position: sticky; top: 0; align-self: start; height: 100dvh; overflow-y: auto; }
  .workspace .topbar-inner { display: flex; flex-direction: column; align-items: stretch; min-height: 100%; padding: 29px 14px 20px; gap: 38px; }
  .workspace .brand { align-self: flex-start; margin-inline: 8px; }
  .workspace .nav { display: grid; }
  .workspace .nav a { padding-inline: 14px; min-height: 49px; }
  .workspace .nav a[aria-current="page"]::before { inset: 5px auto 5px 0; width: 3px; }
  .workspace .logout { margin: auto 0 0; }
  .workspace .logout button { width: 100%; padding-inline: 14px; }
  .workspace .main { padding-top: 49px; }
}
@media (min-width: 1120px) and (max-width: 1299px) {
  :root { --sidebar: 222px; --gutter: 26px; }
  .today-table :is(th, td) { padding-inline: 10px; }
  .today-table .button { padding-inline: 7px; }
}
@media (max-width: 1119px) {
  .nav a[aria-current="page"]::before { inset: auto 10px 3px; height: 2px; }
}
@media (max-width: 900px) {
  :root { --gutter: 18px; }
  .workspace .topbar-inner { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; row-gap: 0; padding-block: 8px 0; }
  .workspace .brand { grid-area: 1 / 1; width: max-content; min-height: 44px; font-size: 20px; gap: 9px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 6px; }
  .logout { grid-area: 1 / 2; }
  .logout button { gap: 6px; padding-inline: 5px; font-size: 14px; }
  .logout .icon { width: 17px; height: 17px; }
  .nav { grid-area: 2 / 1 / auto / -1; display: grid; grid-template-columns: .65fr .85fr 1.15fr 1.18fr; gap: 2px; }
  .nav a { min-height: 44px; justify-content: center; padding-inline: 3px; font-size: clamp(12px, 3.45vw, 15px); }
  .nav a .icon { display: none; }
  .nav a[aria-current="page"] { background: transparent; }
  .nav a[aria-current="page"]::before { inset: auto 10% 0; height: 3px; }

  .main { padding-block: 26px 35px; }
  .page-head { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 12px; margin-bottom: 22px; }
  .page-head h1 { font-size: clamp(36px, 7vw, 56px); }
  .page-head p { font-size: 16px; margin-top: 4px; }
  .page-head > .primary { min-height: 44px; font-size: 15px; }
  .today-head > .primary { justify-self: stretch; }
  .block + .block { margin-top: 23px; }
  .agenda-block { padding-top: 16px; }
  .section-heading { gap: 10px; align-items: flex-start; }
  .section-icon { width: 36px; height: 36px; }
  .section-icon .icon { width: 20px; height: 20px; }
  .block h2 { font-size: clamp(20px, 5vw, 25px); }
  .section-description { font-size: 14px; line-height: 1.38; }
  .block .table-frame, .block .empty { margin-top: 12px; }

  table, tbody { display: block; }
  colgroup { display: none; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr + tr td, .today-table tbody { border-top: 0; }
  .today-table :is(th, td) + :is(th, td) { border-left: 0; }
  .today-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 9px; align-items: start; padding: 10px 11px 11px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); }
  .table-frame:has(.today-table) { border: 0; border-radius: 0; background: transparent; overflow: visible; }
  .today-table tr + tr { margin-top: 7px; }
  .today-table td { padding: 0; font-size: 14px; }
  .today-table .client-name { font-size: 16px; }
  .today-table .secondary { font-size: 13px; }
  .today-table .service-cell { grid-column: 1; color: var(--text-secondary); }
  .today-table .amount { color: var(--text-primary); font-weight: 660; }
  .today-table .date-cell { grid-area: 1 / 2 / span 2; align-self: stretch; border-left: 1px solid var(--border-subtle); padding-left: 9px; }
  .today-table .action-cell { grid-column: 1 / -1; padding-top: 5px; }
  .date-status { text-align: right; }
  .date-status time { font-size: 12px; }
  .today-table .actions { display: grid; gap: 7px; }
  .quote-table .actions { grid-template-columns: 1fr 1fr; }
  .button, .today-table .button { min-height: 44px; }
  .today-table .button { font-size: 13px; padding-inline: 6px; }

  .records-table tr { display: grid; gap: 7px; padding: 13px; }
  .records-table tr + tr { border-top: 1px solid var(--border-subtle); }
  .records-table td { padding: 0; }
  .mobile-label { display: inline-block; margin-right: 6px; color: var(--text-secondary); font-weight: 650; font-size: 13px; }
  .form-panel { padding: 17px; }
  .empty { padding: 15px; }
}
@media (max-width: 350px) {
  :root { --gutter: 13px; }
  .nav a { font-size: 11.5px; }
  .today-table .button { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media (max-width: 900px) {
  .workspace .nav { display: flex; flex-wrap: wrap; justify-content: space-between; }
  .workspace .nav a { min-width: max-content; padding-inline: 3px; font-size: clamp(11px, 3vw, 14px); }
}

.channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.channel-panel, .incoming-message { max-width: none; min-width: 0; }
.channel-panel h2 { display: flex; align-items: center; gap: 8px; font-size: 21px; font-weight: 730; }
.channel-panel h2 .icon { color: var(--accent-hover); }
.channel-panel > p { color: var(--text-secondary); margin-block: 7px 12px; }
.channel-panel > .channel-state { background: var(--bg-recessed); padding: 7px 10px; border-radius: 6px; font-size: 14px; }
.channel-option { display: flex; align-items: center; gap: 9px; min-height: 44px; margin-top: 6px; font-size: 15px; }
.channel-option input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; margin: 0; accent-color: var(--accent); }
.channel-option label { cursor: pointer; }
.channel-panel > button { margin-top: 17px; }
.incoming-forms, .incoming-body { margin-top: 17px; }
.incoming-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.incoming-message .secondary { overflow-wrap: anywhere; }
@media (max-width: 730px) {
  .channel-grid { grid-template-columns: minmax(0, 1fr); }
}

.outlook-panel { margin-bottom: 16px; }
.outlook-panel select { max-width: 460px; }
.outlook-panel .form-actions { margin-top: 14px; }
