/* Brygga App – mobilvennlig adminpanel i samme stil som nettsiden. */
:root {
	--accent: #C0B8A3;
	--accent-strong: #d6cfbb;
	--bg: #141414;
	--panel: #1C1C1C;
	--card: #232323;
	--card-2: #2b2b2b;
	--line: rgba(255, 255, 255, .08);
	--text: #fff;
	--muted: rgba(255, 255, 255, .66);
	--danger: #ff6b5e;
	--ok: #7bd389;
	--radius: 16px;
	--head: "Bebas Neue", Impact, sans-serif;
	--body: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
	color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--head); font-weight: 400; letter-spacing: .5px; margin: 0; line-height: 1.1; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Oppstart ---------- */
.boot { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Ramme ---------- */
.app { max-width: 720px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
	position: sticky; top: 0; z-index: 20;
	display: flex; align-items: center; gap: 10px;
	padding: calc(12px + var(--safe-top)) 16px 12px;
	background: rgba(20, 20, 20, .86);
	-webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--line);
}
.topbar__title { flex: 1; font-family: var(--head); font-size: 28px; line-height: 1; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-width: 40px; height: 40px; padding: 0 10px;
	background: var(--card); border: 1px solid var(--line); border-radius: 12px;
	color: var(--text); cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 500;
}
.topbar__btn svg { width: 20px; height: 20px; }
.topbar__btn--accent { background: var(--accent); color: #1C1C1C; border-color: var(--accent); font-weight: 600; }

.view { flex: 1; padding: 16px 16px calc(96px + var(--safe-bottom)); }
.view--form { padding-bottom: calc(120px + var(--safe-bottom)); }

/* ---------- Bunnmeny ---------- */
.tabs {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
	display: flex; justify-content: center;
	background: rgba(24, 24, 24, .92);
	-webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
	border-top: 1px solid var(--line);
	padding-bottom: var(--safe-bottom);
}
.tabs__inner { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 720px; }
.tab {
	display: flex; flex-direction: column; align-items: center; gap: 2px;
	padding: 9px 2px 8px; color: var(--muted); text-decoration: none;
	font-size: 11px; font-weight: 500; letter-spacing: .2px;
}
.tab svg { width: 24px; height: 24px; }
.tab.is-active { color: var(--accent); }

/* ---------- Kort og lister ---------- */
.hello { margin: 4px 0 18px; }
.hello h1 { font-size: 40px; }
.hello p { margin: 2px 0 0; color: var(--muted); }

.section { margin: 26px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section h2 { font-size: 24px; color: var(--accent); }
.section a, .section button { font-size: 13px; font-weight: 600; color: var(--accent); background: none; border: 0; cursor: pointer; text-decoration: none; padding: 4px; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick a {
	display: flex; flex-direction: column; gap: 10px; padding: 16px;
	background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
	color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px;
}
.quick a svg { width: 26px; height: 26px; color: var(--accent); }
.quick a:active { transform: scale(.98); }

.list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.row {
	display: flex; align-items: center; gap: 12px;
	padding: 10px 12px; min-height: 64px;
	background: var(--card); border: 1px solid var(--line); border-radius: 14px;
	color: var(--text); text-decoration: none; cursor: pointer; width: 100%; text-align: left;
}
.row:active { background: var(--card-2); }
.row__thumb { width: 52px; height: 52px; flex: none; border-radius: 10px; overflow: hidden; background: var(--card-2); display: flex; align-items: center; justify-content: center; color: var(--accent); }
.row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.row__thumb svg { width: 22px; height: 22px; }
.row__date { width: 52px; height: 52px; flex: none; border-radius: 10px; background: var(--accent); color: #1C1C1C; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--head); line-height: 1; }
.row__date b { font-size: 24px; font-weight: 400; }
.row__date span { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.row__main { flex: 1; min-width: 0; }
.row__title { font-weight: 600; font-size: 15px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.row__side { color: var(--accent); font-family: var(--head); font-size: 20px; white-space: nowrap; }
.row > svg, .row__chev { color: var(--muted); flex: none; width: 18px; height: 18px; }
svg { flex: none; }
svg:not([width]) { max-width: 100%; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: rgba(192, 184, 163, .16); color: var(--accent); font-size: 11.5px; font-weight: 600; }
.chip--warn { background: rgba(255, 190, 90, .15); color: #ffc66b; }
.chip--muted { background: rgba(255, 255, 255, .08); color: var(--muted); }
.day-head { margin: 18px 2px 8px; font-family: var(--head); font-size: 20px; letter-spacing: .5px; color: var(--muted); }
.day-head:first-child { margin-top: 4px; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h3 { color: var(--text); font-size: 26px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; }
.segment button { padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.segment button.is-active { background: var(--accent); color: #1C1C1C; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- Knapper ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 48px; padding: 0 20px;
	background: var(--accent); color: #1C1C1C;
	border: 0; border-radius: 12px; cursor: pointer;
	font-weight: 600; font-size: 14px; letter-spacing: .6px; text-transform: uppercase;
	text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.btn--block { width: 100%; }
.btn--ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); text-transform: none; letter-spacing: 0; font-weight: 500; }
.btn--small { min-height: 38px; padding: 0 14px; font-size: 13px; }
.btn--danger { background: transparent; color: var(--danger); border: 1px solid rgba(255, 107, 94, .35); text-transform: none; letter-spacing: 0; }

.fab {
	position: fixed; right: max(16px, calc(50% - 344px)); bottom: calc(78px + var(--safe-bottom)); z-index: 25;
	width: 58px; height: 58px; border-radius: 18px;
	display: flex; align-items: center; justify-content: center;
	background: var(--accent); color: #1C1C1C; border: 0; cursor: pointer;
	box-shadow: 0 10px 26px rgba(0, 0, 0, .45); text-decoration: none;
}
.fab svg { width: 28px; height: 28px; }

/* ---------- Skjema ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .2px; }
.field__hint { font-size: 12.5px; color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=url],
.field input[type=date], .field input[type=time], .field input[type=number], .field input[type=password],
.field select, .field textarea {
	width: 100%; min-height: 50px; padding: 12px 14px;
	background: var(--card); color: var(--text);
	border: 1px solid var(--line); border-radius: 12px;
	font-size: 16px; /* hindrer zoom på iPhone */
	-webkit-appearance: none; appearance: none;
}
.field textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(192, 184, 163, .18); }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field input::-webkit-calendar-picker-indicator { filter: invert(.8); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.switch__text { display: flex; flex-direction: column; }
.switch__text b { font-weight: 600; font-size: 14.5px; }
.switch__text small { color: var(--muted); font-size: 12.5px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__ui { position: relative; flex: none; width: 50px; height: 30px; border-radius: 999px; background: #3a3a3a; transition: background .2s; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .switch__ui { background: var(--accent); }
.switch input:checked + .switch__ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__ui { outline: 2px solid var(--accent); outline-offset: 2px; }

.image-field { display: flex; flex-direction: column; gap: 8px; }
.image-field__preview { position: relative; border-radius: 14px; overflow: hidden; background: var(--card); border: 1px dashed rgba(255, 255, 255, .18); aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; cursor: pointer; }
.image-field__preview img { width: 100%; height: 100%; object-fit: cover; }
.image-field__preview .ph { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13.5px; padding: 12px; }
.image-field__preview .ph svg { width: 30px; height: 30px; color: var(--accent); }
.image-field__actions { display: flex; gap: 8px; }
.image-field__progress { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; }

.notice { padding: 12px 14px; border-radius: 12px; background: rgba(192, 184, 163, .1); border: 1px solid rgba(192, 184, 163, .25); color: var(--accent-strong); font-size: 13.5px; }
.notice--warn { background: rgba(255, 190, 90, .08); border-color: rgba(255, 190, 90, .3); color: #ffd28a; }
.notice--error { background: rgba(255, 107, 94, .1); border-color: rgba(255, 107, 94, .35); color: #ffb0a8; }

.savebar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
	padding: 12px 16px calc(12px + var(--safe-bottom));
	background: rgba(20, 20, 20, .94);
	-webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
	border-top: 1px solid var(--line);
}
.savebar__inner { max-width: 688px; margin: 0 auto; display: flex; gap: 10px; }
.savebar .btn { flex: 1; }
.savebar .btn--ghost { flex: 0 0 auto; }

/* Åpningstider-editor */
.hours-row { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 8px; align-items: center; }
.hours-row input { min-height: 46px !important; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn--danger { color: var(--danger); }

/* Kategori-editor */
.cat-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.cat-row__name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cat-row__count { color: var(--muted); font-size: 12.5px; font-weight: 400; }

/* Mer-menyen */
.menu-links .row { min-height: 58px; }
.menu-links .row__thumb { width: 40px; height: 40px; border-radius: 10px; background: rgba(192, 184, 163, .12); }

/* Toast */
.toast {
	position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); z-index: 60;
	transform: translate(-50%, 20px); opacity: 0;
	max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
	background: #f4f1ea; color: #1C1C1C; font-weight: 600; font-size: 14px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
	transition: transform .25s, opacity .25s; pointer-events: none;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.toast--error { background: #ff6b5e; color: #fff; }

/* Installer-banner */
.install { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(192, 184, 163, .18), rgba(192, 184, 163, .06)); border: 1px solid rgba(192, 184, 163, .3); margin-bottom: 16px; }
.install img { width: 46px; height: 46px; border-radius: 11px; flex: none; }
.install__text { flex: 1; font-size: 13.5px; }
.install__text b { display: block; font-size: 15px; }

/* Forhåndsvisning av import */
.preview-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.preview-table th, .preview-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.preview-table th { color: var(--muted); font-weight: 600; }

/* ---------- Innlogging ---------- */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 18px calc(24px + var(--safe-bottom)); background: radial-gradient(circle at 50% -10%, rgba(192, 184, 163, .16), transparent 55%), var(--bg); }
.login__card { width: 100%; max-width: 400px; }
.login__logo { display: flex; justify-content: center; margin-bottom: 26px; }
.login__logo img { max-width: 200px; max-height: 110px; width: auto; }
.login__logo .login__icon { width: 96px; height: 96px; border-radius: 22px; }
.login h1 { font-size: 46px; text-align: center; }
.login__lead { text-align: center; color: var(--muted); margin: 4px 0 24px; }
.login__form { display: flex; flex-direction: column; gap: 14px; }
.login__error { padding: 12px 14px; border-radius: 12px; background: rgba(255, 107, 94, .12); border: 1px solid rgba(255, 107, 94, .35); color: #ffb0a8; font-size: 14px; }
.login__help { text-align: center; margin-top: 18px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

@media (min-width: 720px) {
	.view { padding-left: 24px; padding-right: 24px; }
	.quick { grid-template-columns: repeat(4, 1fr); }
}
