/* Design pass 2026-10-24: spacing, one meaning per colour, consistent buttons, fewer nested frames.
 * Loaded right before type.css so it wins over the older layers without !important where possible. */

/* 1. Top menu: room between items, quiet inactive items, hover is not the same as "selected". */
.sidebar .nav-links { gap:4px; }
.sidebar .nav-links > a { padding-inline:10px; font-weight:var(--fw-medium); color:var(--muted); }
.sidebar .nav-links > a:hover { background:var(--surface-soft); color:var(--ink); }
.sidebar .nav-links > a.active,
.sidebar .nav-links > a.active:hover { background:var(--active-surface); color:var(--primary-strong); font-weight:var(--fw-medium); }
.sidebar .inbox-trigger { font-weight:var(--fw-medium); color:var(--muted); }
.sidebar .inbox-trigger:hover { color:var(--ink); }
/* 1340-1439px (laptops): same rhythm, slightly tighter; the brand subtitle steps aside to make the room. */
@media (min-width:1340px) and (max-width:1439px) {
  .sidebar .nav-links { gap:2px; }
  .sidebar .nav-links > a { padding-inline:9px; }
  .sidebar .inbox-trigger { padding-inline:9px; }
  .sidebar .brand small { display:none; }
}

/* Bell: no coloured frame; a small dot says there is something (red when something is overdue). */
.notification-button,
.notification-button.has-items:not(.has-alerts),
:root[data-theme] .notification-button.has-items:not(.has-alerts),
:root[data-theme] .notification-button.has-alerts,
.notification-button.has-alerts { background:var(--surface); border-color:var(--line); color:var(--ink); box-shadow:none; }
.notification-button:hover { background:var(--surface-soft); }
.notification-button.has-items::after { content:""; position:absolute; top:6px; right:6px; width:8px; height:8px; border-radius:50%; background:var(--primary-strong); box-shadow:0 0 0 2px var(--surface); }
.notification-button.has-alerts::after { display:none; } /* overdue items already show the red counter */

/* 2. Customer window: the sticky action bar spans the whole window, with its own breathing room. */
#customerDialog .customer-dialog-body,
#customerDialog #customerDetails { background:inherit; }
#customerDialog .customer-toolbar { margin:0 -24px 16px; padding:12px 24px; background:inherit; border-bottom:1px solid var(--line); align-items:center; }
#customerDialog .customer-toolbar > button { flex:0 0 auto; font-weight:var(--fw-strong); }
#customerDialog .customer-toolbar > button:first-child { background:var(--button-primary-bg); border-color:transparent; color:var(--button-primary-text); }
#customerDialog .customer-toolbar > button:first-child:hover { background:var(--button-primary-hover); }
/* Close sits apart from Delete, at the far right. */
#customerDialog .customer-toolbar-close { margin-left:auto; border-color:transparent; background:transparent; font-size:var(--fs-xl); }
#customerDialog .customer-toolbar-close:hover { background:var(--surface-soft); }
/* With the payroll button the actions no longer fit one row: they wrap, and Close stays pinned top-right. */
#customerDialog .customer-toolbar { flex-wrap:wrap; position:sticky; padding-right:76px; }
#customerDialog .customer-toolbar > .customer-toolbar-close { position:absolute; top:12px; right:24px; margin:0; }
/* "Ready" is good news: green line. "Not complete" keeps the amber line. */
.customer-readiness.is-ready { border-left-color:var(--green, #1f8a5f); }
/* Label quiet, value plain; an empty value is quiet too. */
.customer-facts { display:grid; grid-template-columns:auto 1fr; gap:6px 16px; margin:0 0 12px; }
.customer-facts dt { color:var(--muted); font-size:var(--fs-sm); padding-top:1px; }
.customer-facts dd { margin:0; }
.customer-facts .is-empty { color:var(--muted); }
.customer-sections .tax-obligation::first-letter { text-transform:uppercase; }

/* 3. Buttons: three kinds only. Primary (filled), normal (framed), quiet (no frame in a toolbar). */
.filters :is(#personalActionsToggle, #calendarToggleButton),
.filters .board-more > summary { min-height:40px !important; height:40px; padding-inline:12px; border:1px solid transparent; border-radius:8px; background:transparent; color:var(--ink); font-weight:var(--fw-medium); }
.filters :is(#personalActionsToggle, #calendarToggleButton):hover,
.filters .board-more > summary:hover { background:var(--surface-soft); }
.filters #personalActionsToggle[aria-pressed="true"] { background:var(--active-surface); color:var(--primary-strong); }
.filters .view-segments button { min-height:36px !important; font-weight:var(--fw-medium); }
#toggleCustomerPhotos { border-color:var(--line-strong, var(--line)); background:transparent; color:var(--ink); font-weight:var(--fw-strong); }
#toggleCustomerPhotos[aria-pressed="true"] { background:var(--active-surface); color:var(--primary-strong); }
/* Customers page: actions sit together next to the title; "Add customer" stands alone on the right. */
.section-heading:has(#newCustomer) { justify-content:flex-start; gap:8px; flex-wrap:wrap; }
.section-heading:has(#newCustomer) > h2 { margin-right:16px; }
.section-heading:has(#newCustomer) > #newCustomer { margin-left:auto; }

/* 4. Green means "main action" or "done". Task-type chips are neutral labels. */
.task-card .task-type-chip { background:var(--surface-soft); color:var(--muted); border-color:transparent; }

/* 5. Board: small column menu button, quiet "More" row, thin scrollbar. */
.board-column .column-sort-button { min-width:32px !important; min-height:32px !important; width:32px; height:32px; border-color:transparent; background:transparent; color:var(--muted); }
.board-column .column-sort-button:hover,
.board-column .column-sort-button[aria-expanded="true"] { background:var(--surface-soft); color:var(--ink); }
body .board .task-card .task-extra { border-top:0; }
body .board .task-card .task-extra > summary { color:var(--muted); font-size:var(--fs-sm); }
body .board .task-card .task-extra > summary:hover { color:var(--ink); }
.board-column .task-list { scrollbar-width:thin; scrollbar-color:transparent transparent; }
.board-column .task-list:hover { scrollbar-color:var(--line-strong, var(--line)) transparent; }

/* 6. Fewer nested frames: inside a card or a section, chips and inner blocks use tone, not a border. */
.task-card .deadline-chip { border-color:transparent; }
.customer-sections details { border-color:transparent; background:var(--surface); }

/* Checklist item: the narrow column was the date (middle), so the date ran into the time. Date gets room, time is the narrow one. */
.checklist-deadline-row { grid-template-columns:minmax(0, 1fr) minmax(160px, 1fr) minmax(120px, .7fr); }
.checklist-deadline-row input { width:100%; min-width:0; box-sizing:border-box; }

/* Customer window "⋯": start closing and delete live in a small menu (customers.js moves the buttons in). */
#customerDialog .customer-more { position:relative; flex:0 0 auto; margin:0; padding:0; border:0; background:none; }
#customerDialog .customer-more > summary { list-style:none; display:inline-grid; place-items:center; width:44px; min-height:44px; padding:0; border:1px solid var(--line); border-radius:10px; color:var(--ink); font-size:var(--fs-xl); font-weight:var(--fw-bold); line-height:1; cursor:pointer; }
#customerDialog .customer-more > summary::before { content:none; }
#customerDialog .customer-more > summary::-webkit-details-marker { display:none; }
#customerDialog .customer-more > summary:hover,
#customerDialog .customer-more[open] > summary { background:var(--surface-soft); }
#customerDialog .customer-more-menu { position:absolute; top:calc(100% + 6px); right:0; z-index:5; min-width:240px; padding:6px; display:grid; gap:2px; border:1px solid var(--line); border-radius:12px; background:var(--surface); box-shadow:0 12px 32px rgba(0,0,0,.25); }
/* When "⋯" wraps to the left of the dialog, the menu opens to the right instead of past the dialog edge. */
#customerDialog .customer-more-menu.opens-right { right:auto; left:0; }
#customerDetails .customer-more-menu > button,
#customerDetails .customer-more-menu #deleteCustomer { display:flex; justify-content:flex-start; align-items:center; gap:10px; width:100%; min-height:40px !important; margin:0; padding:8px 12px; border:0; border-radius:8px; background:transparent; color:var(--ink); font-size:var(--fs-md); font-weight:var(--fw-medium); text-align:left; }
#customerDetails .customer-more-menu > button:hover,
#customerDetails .customer-more-menu #deleteCustomer:hover { background:var(--surface-soft); }
#customerDetails .customer-more-menu #deleteCustomer { color:#d64545; }
:root[data-theme="dark"] #customerDetails .customer-more-menu #deleteCustomer { color:#ff9a95; }

/* Board cards without frames: tone and a soft shadow separate them. Due today / overdue keep a thin bar on the left. */
body .board:not(.list-view) .task-card { border-color:transparent; box-shadow:0 1px 2px rgba(23,32,47,.06), 0 2px 8px rgba(23,32,47,.05); }
:root[data-theme="dark"] body .board:not(.list-view) .task-card { background:#262f37; box-shadow:0 1px 2px rgba(0,0,0,.35); }
body .board:not(.list-view) .task-card:is(.notification-due-today, .deadline-today) { box-shadow:inset 3px 0 0 #e6a23c, 0 1px 2px rgba(23,32,47,.06), 0 2px 8px rgba(23,32,47,.05); }
body .board:not(.list-view) .task-card:is(.notification-overdue, .deadline-overdue) { border-left-color:transparent; box-shadow:inset 3px 0 0 #e5483d, 0 1px 2px rgba(23,32,47,.06), 0 2px 8px rgba(23,32,47,.05); }
:root[data-theme="dark"] body .board:not(.list-view) .task-card:is(.notification-due-today, .deadline-today) { box-shadow:inset 3px 0 0 #e6a23c, 0 1px 2px rgba(0,0,0,.35); }
:root[data-theme="dark"] body .board:not(.list-view) .task-card:is(.notification-overdue, .deadline-overdue) { box-shadow:inset 3px 0 0 #e5483d, 0 1px 2px rgba(0,0,0,.35); }
:root .board-column .task-card .task-priority-label { border-color:transparent; }
.board-column .empty-state { border-color:transparent; background:color-mix(in srgb, var(--ink) 4%, transparent); }

/* 7. Customers table: the column header already says VÖEN. */
.customer-table .tax-label { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }


/* 8. Customer edit: director block for legal entities sits under the legal status choice. */
#directorFields { grid-column:1/-1; margin-top:0; }

/* Inbox: blink while notes wait to be distributed (inbox.js sets .has-pending). */
@keyframes inbox-pending-blink { from { background:var(--surface); border-color:var(--line-strong); } to { background:var(--danger-bg); border-color:var(--danger-border); color:var(--danger-text-strong); } }
.inbox-trigger.has-pending, .sidebar .inbox-trigger.has-pending { animation:inbox-pending-blink .8s ease-in-out infinite alternate; }
.inbox-trigger.has-pending .inbox-badge { background:var(--danger-text-strong); color:var(--surface); }
