/* ==========================================================================
   Kundportal – stilmall
   --------------------------------------------------------------------------
   Samma designvariabler som admin-gränssnittet (main.css), så att portalen
   och admin känns som samma system. Grått tema är standard; blått väljs med
   'theme' => 'blue' i src/config.php.

   Upplägg:
     1. Designvariabler
     2. Grund
     3. Layout (sidhuvud, sida, sidfot)
     4. Komponenter
     5. Sidor (översikt, order, inloggning)
     6. Mobil och utskrift
   ========================================================================== */


/* 1. Designvariabler
   ========================================================================== */

:root {
	--bg:             #e8eaed;
	--surface:        #ffffff;
	--surface-sunken: #f3f4f6;
	--surface-hover:  #eceef1;

	--text:           #1e2228;
	--text-muted:     #5f6772;
	--text-faint:     #8a919b;

	--border:         #d6dae0;
	--border-strong:  #b3b9c2;

	--accent:         #3a414c;
	--accent-hover:   #262b33;
	--accent-soft:    #e1e4e9;
	--accent-contrast:#ffffff;

	/* Status: samma i alla teman. Texten är mörkare än i admin för att klara kontrastkraven. */
	--ok:             #1e7f4a;
	--ok-soft:        #e3f3e9;
	--warn:           #8a5608;
	--warn-soft:      #fdf1dc;
	--warn-line:      #efd3a4;
	--bad:            #b8322b;
	--bad-soft:       #fbe7e5;
	--info:           #245d98;
	--info-soft:      #e3eef9;

	--font:           system-ui, -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;
	--font-mono:      ui-monospace, "SF Mono", Menlo, Consolas, monospace;

	--radius-sm:      6px;
	--radius:         8px;
	--radius-lg:      12px;
	--shadow-panel:   0 1px 2px rgba(20, 24, 31, .06), 0 0 0 1px rgba(20, 24, 31, .05);
	--focus-ring:     0 0 0 3px rgba(58, 65, 76, .28);

	--page-pad:       48px;
	--control:        44px;
}

[data-theme="blue"] {
	--bg:             #e6ecf3;
	--surface-sunken: #f1f5fa;
	--surface-hover:  #e8f0fa;
	--text:           #172233;
	--text-muted:     #56657a;
	--text-faint:     #8594a8;
	--border:         #d2dce8;
	--border-strong:  #aebdd0;
	--accent:         #1d5fae;
	--accent-hover:   #154a8a;
	--accent-soft:    #dde9f7;
	--focus-ring:     0 0 0 3px rgba(29, 95, 174, .3);
}


/* 2. Grund
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 14px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: 28px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin-bottom: 12px; }

p { margin: 0; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* Knapp som ser ut som en länk (t.ex. "Logga ut" i ett formulär) */
.link-button {
	padding: 0;
	border: 0;
	background: none;
	color: var(--accent);
	text-decoration: underline;
	cursor: pointer;
}
.link-button:hover { color: var(--accent-hover); }

small { font-size: 12px; }

input, select, textarea, button { font: inherit; color: inherit; }

input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
	height: var(--control);
	padding: 0 12px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	transition: border-color .12s, box-shadow .12s;
}
textarea {
	height: auto;
	padding: 10px 12px;
	resize: vertical;
	line-height: 1.5;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: var(--focus-ring);
}
[aria-invalid="true"] { border-color: var(--bad); }

a:focus-visible, button:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.icon { flex-shrink: 0; }

.muted  { color: var(--text-muted); }
.small  { font-size: 13px; }
.block  { display: block; }
.mono   { font-family: var(--font-mono); font-size: 13px; }
.strong { font-weight: 600; }

.visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.skip-link {
	position: absolute;
	left: 16px;
	top: -60px;
	z-index: 100;
	padding: 10px 14px;
	background: var(--surface);
	border-radius: var(--radius);
	box-shadow: var(--shadow-panel);
}
.skip-link:focus { top: 12px; }

/* Visa-knappen behövs bara när JavaScript saknas (annars skickas valet direkt) */
.js .no-js-only { display: none; }


/* 3. Layout
   ========================================================================== */

.topbar {
	display: flex;
	align-items: center;
	gap: 48px;
	height: 64px;
	padding: 0 var(--page-pad);
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--text);
	text-decoration: none;
}
.brand-mark {
	width: 32px;
	height: 32px;
	border-radius: var(--radius);
	background: var(--accent);
	color: var(--accent-contrast);
	display: flex;
	align-items: center;
	justify-content: center;
}
.brand-text {
	display: flex;
	flex-direction: column;
	line-height: 1.15;
}
.brand-text strong { font-size: 15px; }
.brand-text small  { color: var(--text-muted); }

.mainnav {
	display: flex;
	gap: 28px;
	align-self: stretch;
}
.mainnav a {
	display: flex;
	align-items: center;
	padding: 0 4px;
	border-bottom: 2px solid transparent;
	color: var(--text-muted);
	text-decoration: none;
}
.mainnav a .icon { display: none; }   /* ikonerna visas bara i mobilmenyn */
.mainnav a:hover { color: var(--text); }
.mainnav a[aria-current="page"] {
	color: var(--text);
	font-weight: 600;
	border-bottom-color: var(--accent);
}

.account {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 14px;
}
.account form { display: contents; }
.account-name {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	line-height: 1.2;
}
.account-name strong { font-size: 13px; }
.account-name small  { color: var(--text-muted); }

.avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--surface-sunken);
	border: 1px solid var(--border);
	color: var(--text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 600;
}
.avatar-lg { width: 44px; height: 44px; }

/* Byt konto */
.account-list { list-style: none; margin: 0; padding: 0; }
.account-list li + li { border-top: 1px solid var(--border); }
.account-list form { display: contents; }
.account-choice {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 24px;
	border: 0;
	background: transparent;
	color: var(--text);
	font: inherit;
	text-align: left;
}
button.account-choice { cursor: pointer; }
button.account-choice:hover { background: var(--surface-hover); }
button.account-choice .icon { color: var(--text-muted); }
.account-choice-name { display: flex; flex-direction: column; line-height: 1.3; }

.page {
	flex-grow: 1;
	width: 100%;
	max-width: 1440px;
	margin: 0 auto;
	padding: 32px var(--page-pad) 32px;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.page-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
}
.page-head p { margin-top: 4px; }

.title-row {
	display: flex;
	align-items: center;
	gap: 16px;
}

.columns {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 400px;
	gap: 24px;
	align-items: start;
}
.columns-wide-right {
	grid-template-columns: minmax(0, 1fr) 360px;
	align-items: stretch;
}

.stack {
	display: flex;
	flex-direction: column;
	gap: 24px;
	min-width: 0;
}

.footer {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 24px;
	padding: 24px var(--page-pad);
	color: var(--text-muted);
	font-size: 12px;
}
.footer-note { margin-left: auto; }


/* 4. Komponenter
   ========================================================================== */

/* Paneler ----------------------------------------------------------------- */

.panel {
	background: var(--surface);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-panel);
	padding: 24px;
	min-width: 0;
}
.panel-flush {
	padding: 0;
	overflow: hidden;
}

.panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 24px;
	border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; }
.panel-head a  { font-size: 13px; }
.panel-head-tight {
	padding: 0 0 4px;
	border: 0;
}

.empty {
	padding: 40px 24px;
	color: var(--text-muted);
	text-align: center;
}

/* Knappar ----------------------------------------------------------------- */

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: var(--control);
	padding: 0 18px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .12s, border-color .12s, color .12s;
}
.button:hover { background: var(--surface-hover); color: var(--text); }
.button:disabled { opacity: .6; cursor: progress; }

.button-primary {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-contrast);
}
.button-primary:hover {
	background: var(--accent-hover);
	border-color: var(--accent-hover);
	color: var(--accent-contrast);
}

.button-danger {
	border-color: #e2b3af;
	color: var(--bad);
}
.button-danger:hover {
	background: var(--bad);
	border-color: var(--bad);
	color: #ffffff;
}

.button-small {
	height: 32px;
	padding: 0 10px;
	font-size: 13px;
	font-weight: 500;
}
.button-block { width: 100%; }

.icon-button {
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: var(--radius);
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
}
.icon-button:hover { background: var(--surface-hover); color: var(--text); }
.icon-button-outline {
	width: 36px;
	height: 36px;
	border: 1px solid var(--border);
	color: var(--text);
}

/* Statusetiketter --------------------------------------------------------- */

.tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 20px;
	white-space: nowrap;
}
.tag::before {
	content: '';
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}
.tag-ok   { background: var(--ok-soft);   color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-bad  { background: var(--bad-soft);  color: var(--bad); }
.tag-info { background: var(--info-soft); color: var(--info); }
.tag-mute { background: var(--surface-sunken); color: var(--text-muted); }

/* Meddelande efter en åtgärd --------------------------------------------- */

.flash {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-radius: var(--radius);
	font-weight: 500;
}
.flash-ok  { background: var(--ok-soft);  color: var(--ok); }
.flash-bad { background: var(--bad-soft); color: var(--bad); }

/* Nyckeltal --------------------------------------------------------------- */

.stats {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px;
}
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}
.stat-label, .stat-sub { color: var(--text-muted); }
.stat-label { font-size: 13px; }
.stat-sub   { font-size: 12px; }
.stat-value {
	font-size: 30px;
	font-weight: 700;
	letter-spacing: -.02em;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.stat-warn .stat-value { color: var(--warn); }
.stat-bad  .stat-value { color: var(--bad); }

/* Framhävd ruta (offert som väntar) -------------------------------------- */

.notice {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 20px 24px;
	border-radius: var(--radius-lg);
}
.notice-warn {
	background: var(--warn-soft);
	border: 1px solid var(--warn-line);
}
.notice-icon {
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	border-radius: 50%;
	background: #ffffff;
	color: var(--warn);
	display: flex;
	align-items: center;
	justify-content: center;
}
.notice-text {
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	color: #5c4a2b;
}
.notice-text strong {
	color: var(--text);
	font-size: 15px;
}

/* Verktygsrad med flikar och sökning ------------------------------------- */

.toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	padding: 16px;
	border-bottom: 1px solid var(--border);
}
.toolbar-form {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 12px;
}

.segmented {
	display: flex;
	gap: 4px;
	padding: 4px;
	background: var(--surface-sunken);
	border-radius: 10px;
}
.segmented a {
	display: flex;
	align-items: center;
	gap: 6px;
	height: 36px;
	padding: 0 16px;
	border-radius: 7px;
	color: var(--text-muted);
	text-decoration: none;
}
.segmented a:hover { color: var(--text); }
.segmented a[aria-current="page"] {
	background: var(--surface);
	color: var(--text);
	font-weight: 600;
	box-shadow: 0 1px 2px rgba(20, 24, 31, .12);
}
.segmented .count { font-weight: 500; color: var(--text-muted); }

.search {
	position: relative;
	display: flex;
	align-items: center;
}
.search .icon {
	position: absolute;
	left: 12px;
	color: var(--text-faint);
	pointer-events: none;
}
.search input {
	width: 300px;
	height: 40px;
	padding-left: 36px;
}
.toolbar select { height: 40px; }
.inline-label { font-size: 13px; color: var(--text-muted); }

/* Tabeller ---------------------------------------------------------------- */

.table {
	width: 100%;
	border-collapse: collapse;
}
.table th {
	padding: 10px 16px;
	background: var(--surface-sunken);
	border-bottom: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 600;
	text-align: left;
	white-space: nowrap;
}
.table td {
	padding: 14px 16px;
	border-bottom: 1px solid var(--surface-sunken);
	vertical-align: middle;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-hover); }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child,  .table td:last-child  { padding-right: 24px; }

.table .num  { text-align: right; }
.table .wrap { white-space: normal; min-width: 180px; }

/* Hela raden är klickbar via länken i första cellen */
.table tbody tr { position: relative; }
.row-link {
	color: var(--text);
	text-decoration: none;
}
.row-link::after {
	content: '';
	position: absolute;
	inset: 0;
}
.row-link:focus-visible { outline: none; }
tr:has(.row-link:focus-visible) td { background: var(--accent-soft); }

.chevron { color: var(--text-faint); display: inline-flex; }
.chevron-cell, .actions-cell { width: 1%; text-align: right; }
.actions-cell { position: relative; z-index: 1; }

/* Listor ------------------------------------------------------------------ */

.mini-list, .doc-list, .contact-list, .order-cards, .timeline {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mini-list li, .doc-list li {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 0;
	border-top: 1px solid var(--surface-sunken);
}
.mini-list-main, .doc-main {
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.mini-list small, .doc-main small { color: var(--text-muted); }
.amount {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.doc-icon {
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	border-radius: var(--radius);
	background: var(--surface-sunken);
	color: var(--text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
}
.doc-list .is-pending strong { color: var(--text-muted); font-weight: 500; }
.doc-list .is-pending .doc-icon { color: var(--text-faint); }

.person {
	display: flex;
	align-items: center;
	gap: 14px;
}
.person div { display: flex; flex-direction: column; }
.person small { color: var(--text-muted); }

.contact-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 16px;
	font-size: 13px;
	color: var(--text-muted);
}
.contact-list li { display: flex; align-items: center; gap: 10px; }

.kv {
	display: grid;
	grid-template-columns: 90px minmax(0, 1fr);
	gap: 8px 12px;
	margin: 0 0 14px;
	font-size: 13px;
}
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }


/* 5. Sidor
   ========================================================================== */

/* Översikt: pågående ordrar ------------------------------------------------ */

.order-card {
	display: grid;
	grid-template-columns: 70px minmax(0, 1fr) 210px 190px 70px 16px;
	gap: 20px;
	align-items: center;
	padding: 16px 24px;
	border-top: 1px solid var(--surface-sunken);
	color: var(--text);
	text-decoration: none;
}
.order-cards li:first-child .order-card { border-top: 0; }
.order-card:hover { background: var(--surface-hover); color: var(--text); }
.order-card-id { font-weight: 600; }
.order-card-main, .order-card-progress {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.order-card-main strong {
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.order-card small { color: var(--text-muted); }
.order-card-progress { gap: 6px; }
.order-card-eta { text-align: right; font-weight: 600; }

/* Stegindikator i listor */
.progress {
	display: flex;
	gap: 4px;
	width: 100%;
	max-width: 180px;
}
.progress span {
	flex-grow: 1;
	height: 6px;
	border-radius: 3px;
	background: var(--border);
}
.progress .is-done { background: var(--accent); }

/* Order: fakta och steg ---------------------------------------------------- */

.breadcrumb {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: -8px;
	font-size: 13px;
	color: var(--text-muted);
}
.breadcrumb a {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 20px;
	margin: 0;
}
.facts div { display: flex; flex-direction: column; gap: 2px; }
.facts dt  { font-size: 12px; color: var(--text-muted); }
.facts dd  { margin: 0; font-weight: 600; }

.stepper {
	list-style: none;
	display: flex;
	margin: 24px 0 0;
	padding: 24px 0 0;
	border-top: 1px solid var(--surface-sunken);
}
.step {
	position: relative;
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	text-align: center;
}
/* linjen till nästa steg */
.step:not(:last-child)::after {
	content: '';
	position: absolute;
	top: 13px;
	left: calc(50% + 20px);
	right: calc(-50% + 20px);
	height: 2px;
	background: var(--border);
}
.step-done:not(:last-child)::after { background: var(--accent); }

.step-dot {
	width: 28px;
	height: 28px;
	margin-bottom: 4px;
	border-radius: 50%;
	border: 2px solid var(--border);
	background: var(--surface);
	display: flex;
	align-items: center;
	justify-content: center;
}
.step-done .step-dot {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-contrast);
}
.step-current .step-dot { border-color: var(--warn); }
.step-current .step-dot::before {
	content: '';
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--warn);
}
.step-name { font-weight: 600; }
.step-todo .step-name { color: var(--text-muted); font-weight: 400; }
.step-current .step-name { font-weight: 700; }
.step-date { font-size: 12px; color: var(--text-muted); }
.step-current .step-date { color: var(--warn); font-weight: 600; }
.step-todo .step-date { color: var(--text-faint); }

/* Order: offert ------------------------------------------------------------ */

.quote {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 24px;
	background: var(--warn-soft);
	border: 1px solid var(--warn-line);
	border-radius: var(--radius-lg);
	scroll-margin-top: 16px;
}
.quote-head {
	display: flex;
	align-items: flex-start;
	gap: 16px;
}
.quote-head .notice-icon { width: 40px; height: 40px; }
.quote-head h2 { margin: 0 0 4px; }
.quote-head p  { color: #5c4a2b; max-width: 62ch; }
.quote-total {
	margin-left: auto;
	text-align: right;
	white-space: nowrap;
}
.quote-total small  { display: block; color: #5c4a2b; }
.quote-total strong { font-size: 26px; letter-spacing: -.02em; }

.quote-items {
	width: 100%;
	border-collapse: collapse;
	background: var(--surface);
	border-radius: var(--radius);
	overflow: hidden;
}
.quote-items td {
	padding: 10px 14px;
	border-bottom: 1px solid var(--surface-sunken);
}
.quote-items tr:last-child td { border-bottom: 0; }
.quote-items .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.quote-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}
.quote-approve {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	flex-grow: 1;
}
.quote-approve label { font-size: 13px; font-weight: 600; }
.quote-approve input { width: 200px; border-color: #e3c898; }
.quote-approve .button { margin-left: auto; }
.quote-note { font-size: 12px; color: #5c4a2b; }

/* Order: meddelande och händelser ----------------------------------------- */

.message-form {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 12px;
}
.message-form label { font-size: 13px; font-weight: 600; }
.message-form textarea { margin-bottom: 6px; }
.message-form .button { align-self: flex-end; }

.timeline li {
	position: relative;
	display: flex;
	flex-direction: column;
	padding: 0 0 18px 24px;
}
.timeline li::before {       /* punkten */
	content: '';
	position: absolute;
	left: 0;
	top: 5px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--border-strong);
}
.timeline li:not(:last-child)::after {   /* linjen ner till nästa */
	content: '';
	position: absolute;
	left: 4px;
	top: 18px;
	bottom: 0;
	width: 2px;
	background: var(--border);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline .is-latest::before { background: var(--accent); }
.timeline .is-latest .timeline-text { font-weight: 600; }
.timeline time { font-size: 12px; color: var(--text-muted); }

/* Inloggning ------------------------------------------------------------ */

.login {
	flex-grow: 1;
	display: grid;
	grid-template-columns: minmax(360px, 620px) minmax(0, 1fr);
	min-height: 100vh;
}

.login-intro {
	display: flex;
	flex-direction: column;
	padding: 56px 64px;
	background: var(--accent);
	color: var(--accent-contrast);
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-text strong { font-size: 17px; }
.login-brand .brand-text small  { color: inherit; opacity: .75; font-size: 13px; }
.brand-mark-light {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: rgba(255, 255, 255, .14);
}

.login-pitch {
	margin: auto 0;
	padding: 48px 0;
	display: flex;
	flex-direction: column;
	gap: 28px;
}
.login-pitch h1 {
	font-size: 40px;
	line-height: 1.15;
	max-width: 14em;
}
.login-points {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
	font-size: 15px;
}
.login-points li { display: flex; align-items: center; gap: 12px; }
.login-points span {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	display: flex;
	align-items: center;
	justify-content: center;
}
.login-contact { font-size: 13px; opacity: .8; }

.login-form-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48px 24px;
	background: var(--surface);
}
.login-form {
	width: 100%;
	max-width: 380px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}
.login-form h2 { font-size: 26px; margin-bottom: 6px; letter-spacing: -.01em; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 13px; }
.field input { font-size: 15px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
.small-link { font-size: 13px; }
.login-form .button { height: 48px; font-size: 15px; }
.login-step { display: flex; flex-direction: column; gap: 20px; }
.code-input { font-size: 24px !important; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.login-foot {
	padding-top: 18px;
	border-top: 1px solid var(--border);
	font-size: 13px;
}


/* 6. Mindre skärmar och utskrift
   ========================================================================== */

@media (max-width: 1100px) {
	:root { --page-pad: 24px; }

	.columns, .columns-wide-right { grid-template-columns: minmax(0, 1fr); }
	.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.topbar { gap: 24px; }
	.account-name { display: none; }

	.order-card { grid-template-columns: 60px minmax(0, 1fr) auto 16px; }
	.order-card-progress, .order-card-eta { display: none; }

	.toolbar-form { margin-left: 0; width: 100%; }
	.search { flex-grow: 1; }
	.search input { width: 100%; }
}

@media (max-width: 720px) {
	:root { --page-pad: 16px; }

	body { font-size: 15px; }
	h1 { font-size: 24px; }

	/* Menyn flyttas till en fast rad längst ner */
	.topbar { height: 56px; }
	.mainnav {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 20;
		height: 64px;
		padding-bottom: env(safe-area-inset-bottom);
		gap: 0;
		background: var(--surface);
		border-top: 1px solid var(--border);
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
	.mainnav a {
		flex-direction: column;
		justify-content: center;
		gap: 2px;
		border-bottom: 0;
		font-size: 11px;
	}
	.mainnav a .icon { display: block; }
	.mainnav a[aria-current="page"] { color: var(--accent); }
	.page { padding-bottom: 96px; }
	.footer { padding-bottom: 96px; }
	.footer-note { margin-left: 0; }

	.stats, .stats-3 { grid-template-columns: minmax(0, 1fr); gap: 16px; }
	.stat-value { font-size: 24px; }

	.notice { flex-wrap: wrap; }
	.notice .button { width: 100%; }

	.page-head { flex-wrap: wrap; }
	.title-row { flex-wrap: wrap; gap: 8px 12px; }
	.title-row h1 { white-space: nowrap; }
	[data-print] { display: none; }
	.facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
	.segmented { width: 100%; }
	.segmented a { flex: 1 1 0; justify-content: center; padding: 0 8px; }
	.toolbar-form { flex-wrap: wrap; }

	/* Tabeller blir kort: en rad per etikett och värde */
	.table-cards thead { display: none; }
	.table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; }
	.table-cards tr {
		padding: 12px 16px;
		border-bottom: 1px solid var(--border);
	}
	.table-cards td {
		position: relative;
		min-height: 28px;
		padding: 4px 0 4px 120px !important;
		border: 0;
		white-space: normal;
		text-align: right;
	}
	.table-cards td[data-label]::before {
		content: attr(data-label);
		position: absolute;
		left: 0;
		top: 5px;
		width: 110px;
		color: var(--text-muted);
		font-family: var(--font);
		font-size: 13px;
		font-weight: 400;
		text-align: left;
	}
	.table-cards .wrap { min-width: 0; }
	.table-cards .chevron-cell { display: none; }
	.table-cards .actions-cell { width: auto; padding: 8px 0 0 !important; }
	.table tbody tr:hover td { background: none; }

	.stepper {
		flex-direction: column;
		gap: 0;
	}
	.step {
		flex-direction: row;
		align-items: center;
		gap: 12px;
		height: 40px;
		text-align: left;
	}
	.step:not(:last-child)::after { display: none; }
	.step-dot { width: 24px; height: 24px; margin: 0; }
	.step-date { margin-left: auto; }

	.quote { padding: 16px; }
	.quote-head { flex-wrap: wrap; }
	.quote-total { margin-left: 0; width: 100%; text-align: left; }
	.quote-approve input { width: 100%; }
	.quote-approve .button, .quote-actions form, .quote-actions .button { width: 100%; margin-left: 0; }

	.login { grid-template-columns: minmax(0, 1fr); }
	.login-intro { padding: 32px 24px; }
	.login-pitch { padding: 32px 0 8px; }
	.login-pitch h1 { font-size: 28px; }
	.login-points, .login-contact { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}

@media print {
	body { background: #ffffff; }
	.topbar, .footer, .breadcrumb, .button, .quote-actions, .message-form, .skip-link { display: none !important; }
	.panel, .quote { box-shadow: none; border: 1px solid var(--border); }
	.columns { grid-template-columns: minmax(0, 1fr); }
}
