/* Klusportaal back office: black on white, the company's own color (from /Home/Theme) on primary buttons and the
   active menu item. Status colors only ever mean a status */
:root {
    --brand: #000000;
    --on-brand: #ffffff;
    --accent: #000000;
    --background: #ffffff;
    --surface: #ffffff;
    --soft: #f5f5f5;
    --foreground: #111111;
    --muted: #666666;
    --border: #e5e5e5;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --warning: #8a5100;
    --warning-soft: #fff3dc;
    --success: #1f7a3d;
    --success-soft: #e6f4ea;
    --info: #1d4ed8;
    --info-soft: #e8efff;
    --radius: 12px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--foreground);
    background: var(--background);
}

a { color: inherit; }

/* Layout: menu on the left, page on the right; on a phone the menu sits on top */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 4px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 16px; text-decoration: none; }
.sidebar .brand img { max-height: 32px; max-width: 160px; }
.sidebar .brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
    display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600;
}
.sidebar nav a:hover { background: var(--soft); color: var(--foreground); }
.sidebar nav a.active { background: var(--brand); color: var(--on-brand); }
.sidebar .group { margin: 14px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sidebar .me { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.sidebar .me form { margin: 6px 0 0; }
.sidebar .me select { margin-top: 6px; }

main { padding: 28px 32px 48px; max-width: 1180px; width: 100%; }

@media (max-width: 860px) {
    .shell { display: block; }
    .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 12px; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar .group { display: none; }
    main { padding: 20px 16px 40px; }
}

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-header p { margin: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row form { margin: 0; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.two { grid-template-columns: 2fr 1fr; }
@media (max-width: 960px) { .grid.two { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; overflow-x: auto; }
.card.soft { background: var(--soft); border-color: var(--soft); }
.card > h2:first-child, .card .spread h2 { margin-bottom: 12px; }
.stat { font-size: 30px; font-weight: 700; line-height: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stats .card { margin: 0; }
.stats .label { color: var(--muted); font-size: 13px; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
td.number, th.number { text-align: right; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
tr.inactive td { color: var(--muted); }
tr.heading td { font-weight: 700; background: var(--soft); }
tfoot td { font-weight: 600; }
tfoot tr.total td { font-size: 17px; font-weight: 700; border-top: 2px solid var(--foreground); }
td form { margin: 0; display: inline; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--soft); color: var(--muted); }
.badge.success { color: var(--success); background: var(--success-soft); }
.badge.warning { color: var(--warning); background: var(--warning-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.info { color: var(--info); background: var(--info-soft); }
.badge.neutral { color: var(--muted); background: var(--soft); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: 12px; text-align: center; font-weight: 700; }

.notice { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; background: var(--soft); }
.notice.success { color: var(--success); background: var(--success-soft); }
.notice.danger { color: var(--danger); background: var(--danger-soft); }
.notice.warning { color: var(--warning); background: var(--warning-soft); }
.validation-summary-valid { display: none; }
.notice ul { margin: 0; padding-left: 18px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.empty { color: var(--muted); padding: 8px 0; }

/* Forms */
.form { max-width: 640px; }
.form.wide { max-width: none; }
label { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 8px 0; }
label.check input { width: auto; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--foreground); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--foreground); outline-offset: 1px; }
input[type=color] { width: 52px; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
textarea { resize: vertical; min-height: 90px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 20px 20px; margin: 20px 0 0; }
legend { font-weight: 700; padding: 0 6px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.field-error { display: block; color: var(--danger); font-size: 13px; margin-top: 4px; }
.field-error:empty { display: none; }
.input-validation-error { border-color: var(--danger) !important; }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 24px; flex-wrap: wrap; }

button, .button {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--foreground);
    background: #fff; color: var(--foreground); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
button.primary, .button.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
button.danger, .button.danger { color: var(--danger); border-color: var(--danger); }
button.plain, .button.plain { border-color: transparent; padding-left: 4px; padding-right: 4px; }
button.small, .button.small { padding: 4px 12px; font-size: 13px; }
button:hover, .button:hover { opacity: .85; }

/* Lines and areas editors */
table.editor td { padding: 6px 4px; vertical-align: top; }
table.editor input, table.editor select { padding: 7px 8px; }
table.editor .w-qty { width: 90px; } table.editor .w-unit { width: 90px; } table.editor .w-price { width: 110px; } table.editor .w-vat { width: 80px; }
table.editor .w-num { width: 90px; }
.totals { margin-left: auto; max-width: 320px; }

/* Tabs on a project's page: plain anchors to its sections */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 20px; overflow-x: auto; }
.tabs a { padding: 10px 12px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--foreground); border-color: var(--foreground); }
section { scroll-margin-top: 16px; }

/* Progress of a project, as the client sees it */
.steps { display: flex; gap: 0; margin: 8px 0 20px; list-style: none; padding: 0; counter-reset: step; overflow-x: auto; }
.steps li { flex: 1; min-width: 96px; position: relative; padding-top: 30px; font-size: 13px; color: var(--muted); text-align: center; }
.steps li::before {
    counter-increment: step; content: counter(step); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); background: #fff; font-size: 12px; line-height: 20px; font-weight: 700;
}
.steps li::after { content: ""; position: absolute; top: 11px; left: calc(50% + 14px); right: calc(-50% + 14px); height: 2px; background: var(--border); }
.steps li:last-child::after { display: none; }
.steps li.done { color: var(--foreground); }
.steps li.done::before { background: var(--foreground); border-color: var(--foreground); color: #fff; content: "✓"; }
.steps li.done::after { background: var(--foreground); }
.steps li.current { color: var(--foreground); font-weight: 700; }
.steps li.current::before { border-color: var(--accent); background: var(--accent); color: var(--on-brand); }

/* The chat */
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; padding: 4px; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; background: var(--soft); white-space: pre-line; }
.bubble.mine { align-self: flex-end; background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble .meta { display: block; font-size: 12px; opacity: .7; margin-top: 4px; }
.bubble img { display: block; max-width: 240px; max-height: 240px; border-radius: 10px; margin-top: 6px; }
.bubble a { color: inherit; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--foreground); }
.timeline li.internal::before { background: #fff; border: 2px solid var(--muted); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: 13px; }
.thumb img { display: block; width: 100%; height: 120px; object-fit: cover; background: var(--soft); }
.thumb .file-icon { height: 120px; display: flex; align-items: center; justify-content: center; background: var(--soft); font-weight: 700; color: var(--muted); }
.thumb .body { padding: 8px 10px; }

/* Agenda */
.agenda-day { margin-bottom: 18px; }
.agenda-day h3 { padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.agenda-day.today h3 { color: var(--accent); }
.agenda-item { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--soft); align-items: center; }
.agenda-item.cancelled { opacity: .5; text-decoration: line-through; }

/* Week or month */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented a { padding: 5px 14px; text-decoration: none; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.segmented a + a { border-left: 1px solid var(--border); }
.segmented a.active { background: var(--foreground); color: var(--background); }

/* The month: a week per row, with its number in front to open that week */
.month-card { padding: 0; }
.month { display: grid; grid-template-columns: 36px repeat(7, minmax(0, 1fr)); min-width: 720px; }
.month .weekday { padding: 8px 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--border); }
.month .wk { display: flex; justify-content: center; padding-top: 10px; font-size: 12px; color: var(--muted); text-decoration: none; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.month a.wk:hover { background: var(--soft); color: var(--foreground); }
.month .day { min-height: 116px; padding: 6px 6px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.month .day:nth-child(8n) { border-right: none; }
.month .day.weekend { background: #fafafa; }
.month .day.outside { background: var(--soft); }
.month .day.outside .date { color: #aaaaaa; }
.month .date { align-self: flex-start; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; text-decoration: none; }
.month .date:hover { background: var(--border); }
.month .day.today .date { background: var(--brand); color: var(--on-brand); }
.month .date .long { display: none; }
.month .event { display: block; padding: 2px 6px; border-radius: 6px; font-size: 12px; line-height: 1.45; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--soft); color: var(--foreground); border-left: 3px solid var(--muted); }
.month .event .time { font-weight: 600; }
.month .event.success { background: var(--success-soft); border-left-color: var(--success); }
.month .event.warning { background: var(--warning-soft); border-left-color: var(--warning); }
.month .event.danger { background: var(--danger-soft); border-left-color: var(--danger); }
.month .event.cancelled { opacity: .55; text-decoration: line-through; }
.month .event:hover { filter: brightness(.96); }
.month .more { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 6px; text-decoration: none; }
.month .more:hover { color: var(--foreground); }
.month-empty { display: none; }

/* On a phone the month is a list of the days that have something */
@media (max-width: 760px) {
    .month-card { padding: 4px 16px; }
    .month { display: block; min-width: 0; }
    .month .weekday, .month .wk, .month .day.free, .month .day.outside { display: none; }
    .month .day { min-height: 0; border-right: none; padding: 10px 0; gap: 6px; background: none; }
    .month .day.weekend { background: none; }
    .month .date { height: auto; padding: 0; font-size: 15px; }
    .month .date .long { display: inline; }
    .month .date .short { display: none; }
    .month .day.today .date { background: none; color: var(--accent); }
    .month .event { font-size: 13.5px; padding: 6px 8px; white-space: normal; }
    .month-empty { display: block; }
}

/* House style preview: the app's sign-in screen and a card, in the chosen colors */
.preview { border: 1px solid var(--border); border-radius: 28px; padding: 22px; max-width: 320px; background: #fff; }
.preview .logo { max-height: 44px; max-width: 200px; display: block; margin-bottom: 14px; }
.preview .app-name { font-weight: 800; font-size: 20px; margin-bottom: 6px; }
.preview .welcome { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.preview .pill { display: block; text-align: center; padding: 12px; border-radius: 999px; background: var(--preview-brand, var(--brand)); color: var(--preview-on-brand, var(--on-brand)); font-weight: 700; }
.preview .accent-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--preview-accent, var(--accent)); margin-right: 6px; }

.login { max-width: 400px; margin: 10vh auto; padding: 0 16px; }
.login h1 { margin-bottom: 4px; }
.login .card { padding: 28px; }

.search { display: flex; gap: 8px; margin: 0; }
.search input { width: 280px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.filters a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.filters a.active { background: var(--foreground); border-color: var(--foreground); color: #fff; }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.preview-logo { max-height: 64px; max-width: 260px; }
details { margin-top: 12px; }
summary { cursor: pointer; }
a.card { text-decoration: none; display: block; }
a.card:hover { border-color: var(--foreground); }
.row select, .row input:not([type=checkbox]):not([type=file]) { width: auto; }
.row label { margin: 0; }
table.editor td:first-child { width: 42%; }
table.editor td input.w-qty, table.editor td input.w-num, table.editor td input.w-price { width: 100px; }
table.editor td select.w-unit, table.editor td select.w-vat { width: 84px; }

/* A measurement in the fields of the company's trade: per part the fields of its kind, side by side */
table.editor.parts td:first-child { width: 20%; }
table.editor.parts select[name$=".Kind"] { width: auto; min-width: 130px; }
.survey-field input.w-num { width: 96px; }
.thumb .caption { font-weight: 600; color: var(--foreground); margin-bottom: 2px; }
.survey-fields[hidden] { display: none; }
.survey-fields { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-end; }
.survey-fields.wide { gap: 4px 16px; margin: 8px 0 4px; }
.survey-field { display: flex; flex-direction: column; gap: 2px; margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.survey-field select { width: auto; min-width: 140px; }
.survey-fields.wide .survey-field { font-size: 13px; }
.survey-fields.wide .survey-field input:not(.w-num) { min-width: 200px; }
label.check.survey-check { margin: 0 0 6px; font-size: 13px; }
