/* Hand-written equivalent of the Tailwind styling in the Next.js version. No build step. */

:root {
    --primary: #C8102E;
    --primary-dark: #a00d24;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --red-50: #fef2f2;
    --red-200: #fecaca;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    --red-800: #991b1b;
    --red-900: #7f1d1d;
    --green-50: #f0fdf4;
    --green-200: #bbf7d0;
    --green-600: #16a34a;
    --green-700: #15803d;
    --green-900: #14532d;
    --radius: 0.5rem;
    color-scheme: light;
}

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

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--gray-50);
    color: var(--gray-900);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }

.container { max-width: 48rem; margin: 0 auto; padding: 0 1rem; }
main.container { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.loading { color: var(--gray-500); font-size: 0.875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Header */
.site-header { background: #fff; border-bottom: 1px solid var(--gray-200); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.header-inner { display: flex; align-items: center; gap: 0.75rem; padding-top: 1rem; padding-bottom: 1rem; }
.logo-mark {
    width: 2rem; height: 2rem; flex-shrink: 0; border-radius: 0.25rem; background: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='M10 3v14M3 10h14' stroke='white' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center;
}
.brand { font-size: 0.75rem; font-weight: 500; color: var(--primary); text-transform: uppercase; letter-spacing: 0.025em; line-height: 1; }
.app-name { font-size: 0.875rem; font-weight: 600; line-height: 1.25; }

/* Sections */
.section { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.05); padding: 1rem; margin-bottom: 1.5rem; }
.section > h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary); }
@media (min-width: 768px) { .section { padding: 1.5rem; } }

.hint { font-size: 0.75rem; color: var(--gray-500); margin-bottom: 0.75rem; }
.empty { font-size: 0.875rem; color: var(--gray-400); font-style: italic; margin-bottom: 1rem; }

/* Fields */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.narrow { max-width: 24rem; display: grid; gap: 0.75rem; }

.field label, .label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--gray-700); margin-bottom: 0.25rem; }
.req { color: var(--red-600); }
.input {
    width: 100%; border: 1px solid var(--gray-300); border-radius: 0.25rem; padding: 0.375rem 0.5rem;
    font-size: 0.875rem; background: #fff;
}
.input:focus { outline: none; border-color: transparent; box-shadow: 0 0 0 2px var(--primary); }
.input.invalid { border-color: var(--red-600); }
.input.num { text-align: right; }
textarea.input { resize: none; }
.error { font-size: 0.75rem; color: var(--red-600); margin-top: 0.125rem; }
.counter { font-size: 0.75rem; color: var(--gray-400); margin-top: 0.25rem; text-align: right; }

.bank { display: flex; gap: 0.75rem; max-width: 24rem; }
.bank .regnr { width: 7rem; flex-shrink: 0; }
.bank .konto { flex: 1; }

/* Row tables: a table on desktop, a card per row on mobile — one markup, two layouts */
.rows { margin-bottom: 1rem; }
.rows-head { display: none; }
.row { position: relative; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 0.75rem; margin-bottom: 0.75rem; display: grid; gap: 0.5rem; }
.row .cell-label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--gray-500); margin-bottom: 0.25rem; }
.row .amount { font-size: 0.875rem; font-weight: 500; color: var(--gray-700); text-align: right; white-space: nowrap; align-self: end; padding-bottom: 0.375rem; }
.row .remove { position: absolute; top: 0.5rem; right: 0.5rem; }
.row .c-date { padding-right: 1.5rem; }

.icon-btn { background: none; border: 0; padding: 0; color: var(--gray-400); line-height: 0; transition: color .15s; }
.icon-btn:hover { color: var(--red-600); }

@media (min-width: 768px) {
    .rows-head, .row { display: grid; gap: 0.5rem; align-items: start; }
    .rows-head { background: var(--gray-50); font-size: 0.75rem; font-weight: 500; color: var(--gray-600); padding: 0.5rem; }
    .row { border: 0; border-top: 1px solid var(--gray-100); border-radius: 0; margin: 0; padding: 0.5rem; }
    .row .cell-label { display: none; }
    .row .remove { position: static; align-self: center; }
    .row .c-date { padding-right: 0; }
    .row .amount { align-self: center; padding-bottom: 0; }
    .mileage .rows-head, .mileage .row { grid-template-columns: 8.5rem 1fr 1fr 5.5rem 7rem 1.25rem; }
    .expense .rows-head, .expense .row { grid-template-columns: 8.5rem 1fr 7rem 1.25rem; }
    .rows-head .right { text-align: right; }
}

.rows-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.add-btn { display: inline-flex; align-items: center; gap: 0.375rem; background: none; border: 0; padding: 0; font-size: 0.875rem; font-weight: 500; color: var(--primary); transition: color .15s; }
.add-btn:hover { color: var(--primary-dark); }
.subtotal { font-size: 0.875rem; color: var(--gray-500); }

/* Attachments */
.dropzone {
    display: block; position: relative; border: 2px dashed var(--gray-300); border-radius: var(--radius);
    padding: 1.5rem; text-align: center; cursor: pointer; transition: border-color .15s;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--primary); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone .icon { color: var(--gray-400); margin: 0 auto 0.5rem; display: block; }
.dropzone p { font-size: 0.875rem; color: var(--gray-600); }
.dropzone .count { font-size: 0.75rem; color: var(--gray-400); margin-top: 0.25rem; }
.thumbs { margin-top: 1rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
@media (min-width: 640px) { .thumbs { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .thumbs { grid-template-columns: repeat(4, 1fr); } }
.thumb { position: relative; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; background: #fff; }
.thumb img { width: 100%; height: 6rem; object-fit: cover; display: block; }
.thumb .doc { height: 6rem; background: var(--gray-100); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem; color: var(--gray-400); }
.thumb .name { font-size: 0.75rem; color: var(--gray-500); padding: 0.25rem 0.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb .remove { position: absolute; top: 0.25rem; right: 0.25rem; background: #fff; border: 0; border-radius: 999px; padding: 0.125rem; line-height: 0; color: var(--red-600); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.thumb .remove:hover { background: var(--red-50); }

/* Totals + submit */
.totals { display: grid; gap: 0.5rem; margin-bottom: 1.5rem; }
.totals .line { display: flex; justify-content: space-between; font-size: 0.875rem; color: var(--gray-600); }
.totals .line strong { font-weight: 500; }
.totals .grand { border-top: 2px solid var(--primary); padding-top: 0.5rem; font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.totals .grand span:last-child { color: var(--primary); }
.actions { display: flex; justify-content: flex-end; }

.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; width: 100%;
    background: var(--primary); color: #fff; border: 0; border-radius: var(--radius);
    font-size: 0.875rem; font-weight: 600; padding: 0.75rem 2rem; text-decoration: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: background-color .15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; }
@media (min-width: 768px) { .btn-primary { width: auto; } }

.btn-outline {
    display: inline-flex; align-items: center; gap: 0.5rem; background: #fff; color: var(--gray-700);
    border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 0.875rem; font-weight: 500;
    padding: 0.625rem 1.25rem; transition: background-color .15s;
}
.btn-outline:hover { background: var(--gray-50); }
.btn-outline:disabled { opacity: .6; }

/* Alerts */
.alert { border-radius: var(--radius); padding: 1rem; margin-bottom: 1.5rem; display: flex; gap: 0.75rem; align-items: flex-start; font-size: 0.875rem; }
.alert.error { background: var(--red-50); border: 1px solid var(--red-200); color: var(--red-800); }
.alert.success { background: var(--green-50); border: 1px solid var(--green-200); color: var(--green-700); padding: 1.25rem; }
.alert.success h2 { color: var(--green-900); font-size: 1rem; font-weight: 600; }
.alert.success .icon { color: var(--green-600); flex-shrink: 0; margin-top: 0.125rem; }
.alert.failed { background: var(--red-50); border: 1px solid var(--red-200); color: var(--red-700); padding: 1.25rem; }
.alert.failed h2 { color: var(--red-900); font-size: 1rem; font-weight: 600; }
.alert.failed .icon { color: var(--red-600); flex-shrink: 0; margin-top: 0.125rem; }
.alert p { margin-top: 0.125rem; }

/* Confirmation */
.summary dl { display: grid; gap: 0.5rem; font-size: 0.875rem; color: var(--gray-700); }
.summary dl > div { display: flex; justify-content: space-between; gap: 1rem; }
.summary dt { color: var(--gray-500); }
.summary .total { font-weight: 600; border-top: 1px solid var(--gray-100); padding-top: 0.5rem; margin-top: 0.25rem; }
.summary .total dt { color: inherit; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.75rem; }
.attach-note { display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: var(--gray-500); margin-top: 1rem; }
.confirm-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding-bottom: 2rem; }
.confirm-actions .btn-primary { width: auto; padding: 0.75rem 1.5rem; }

/* Honeypot */
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none;
    left: 0; padding: 0.6rem 1.25rem 0.7rem; position: fixed; width: 100%; z-index: 1000; font-size: 0.875rem;
}
#blazor-error-ui .dismiss { position: absolute; right: 0.75rem; top: 0.4rem; background: none; border: 0; font-size: 1.25rem; }
.blazor-error-boundary { background: var(--red-700); color: #fff; padding: 1rem; border-radius: var(--radius); }
.blazor-error-boundary::after { content: "Der opstod en fejl."; }

.h-alert { font-size: 1rem; font-weight: 600; outline: none; }
.alert.success .h-alert { color: var(--green-900); }
.alert.failed .h-alert { color: var(--red-900); }
.py { padding-top: 1.5rem; }
h1:focus { outline: none; }
.notfound { padding: 3rem 0; text-align: center; color: var(--gray-500); }
.notfound h1 { font-size: 1.25rem; color: var(--gray-900); margin-bottom: 0.5rem; }
