@import url("tokens-UrEMmb7.css");
@import url("el-EWjR_Wb.css");

/* ===== Grundlag ===== */

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

/* hidden-attributten skal altid vinde — også over display: grid/flex på klasser */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--bg-canvas);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text);
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
}

button,
select,
input {
    font-family: inherit;
    font-size: 16px;
    color: var(--text);
}

.muted {
    color: var(--text-muted);
}

.overline {
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.btn-primary {
    height: 52px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent-fill);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 0 20px;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-outline {
    height: 44px;
    border: 1px solid var(--text);
    border-radius: var(--radius);
    background: none;
    font-size: 16px;
    padding: 0 16px;
    cursor: pointer;
}

.btn-outline:hover {
    background: var(--bg-selected);
}

/* ===== Desktop-layout (skærm 4 + 5) ===== */

.app-desktop {
    max-width: 1280px;
    margin: 28px auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-strong);
}

.topbar-left {
    display: flex;
    align-items: baseline;
    gap: 28px;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
}

.topbar-nav {
    display: flex;
    gap: 22px;
}

.topbar-nav a {
    font-size: 16px;
    color: var(--text-secondary);
    text-decoration: none;
}

.topbar-nav a:hover {
    color: var(--text);
}

.topbar-nav .active {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--accent-fill);
    padding-bottom: 2px;
    text-decoration: none;
}

.sync-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.sync-status .dot {
    width: 7px;
    height: 7px;
    border: 1px solid var(--text-muted);
    display: inline-block;
}

.sync-status.pending {
    color: var(--accent);
    font-weight: 600;
}

.sync-status.pending .dot {
    background: var(--accent-fill);
    border: none;
}

/* ===== Skærm 4 · Overblik ===== */

.overview {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
}

.overview-left {
    padding: 32px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-height: 360px;
}

.overview-left h2 {
    font-size: 26px;
}

.overview-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.overview-head .hint {
    font-size: 13px;
    color: var(--text-muted);
}

.phase-grid {
    display: grid;
    grid-template-columns: 1fr 96px 150px 150px;
    gap: 20px;
    align-items: baseline;
}

.phase-grid-head {
    padding: 0 0 10px;
    border-bottom: 1px solid var(--border-strong);
}

.phase-grid-row {
    padding: 18px 0;
    border-bottom: 1px solid var(--border-subtle);
}

/* Hele etape-rækken er en genvej til Opgaver, filtreret på etapen. */
.phase-row-link {
    color: inherit;
    text-decoration: none;
}

.phase-row-link:hover .phase-name .name {
    text-decoration: underline;
}

.phase-grid .num {
    font-size: 16px;
    text-align: right;
}

.phase-name {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.phase-name .name {
    font-size: 16px;
    font-weight: 600;
}

.phase-name .status {
    font-size: 13px;
    color: var(--text-muted);
}

.overview-empty {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 52ch;
    text-wrap: pretty;
}

.overview-right {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-strong);
    padding-bottom: 8px;
}

.panel-head .title {
    font-size: 16px;
    font-weight: 600;
}

.panel-head .title.critical {
    color: var(--accent);
}

.panel-head .count {
    font-size: 13px;
    color: var(--text-muted);
}

.panel-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
}

.panel-item .room {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.panel-empty {
    font-size: 16px;
    color: var(--text-muted);
}

.panel-link {
    font-size: 16px;
    font-weight: 600;
    padding-top: 4px;
    text-decoration: none;
}

/* ===== Skærm 5 · Opgavetabel ===== */

.filter-bar {
    padding: 22px 32px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    border-bottom: 1px solid var(--border);
}

.filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-bar select {
    height: 44px;
    min-width: 150px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: #fff;
    padding: 0 10px;
}

.filter-bar label.filter-toggle {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    height: 44px;
    font-size: 16px;
    white-space: nowrap;
}

.filter-bar .filter-toggle input {
    width: 18px;
    height: 18px;
}

.filter-count {
    font-size: 13px;
    color: var(--text-muted);
    padding-bottom: 12px;
    margin-left: auto;
}

.bulk-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 32px;
    background: var(--text);
    color: var(--bg-surface-alt);
}

.bulk-bar[hidden] {
    display: none;
}

.bulk-bar .count {
    font-size: 16px;
    font-weight: 600;
}

.bulk-bar .label {
    font-size: 16px;
    color: var(--neutral-300);
}

.bulk-bar select {
    height: 44px;
    border: 1px solid var(--text-placeholder);
    border-radius: var(--radius);
    background: #37322e;
    color: var(--bg-surface-alt);
    padding: 0 10px;
    min-width: 250px;
}

.bulk-bar .apply {
    height: 44px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent-fill);
    color: #fff;
    font-weight: 600;
    padding: 0 18px;
    cursor: pointer;
}

.bulk-bar .apply:hover {
    background: var(--accent-hover);
}

.bulk-bar .clear {
    height: 44px;
    border: none;
    background: none;
    color: var(--neutral-300);
    padding: 0;
    cursor: pointer;
    margin-left: auto;
}

.table-wrap {
    padding: 0 32px 28px;
}

.task-table {
    width: 100%;
    border-collapse: collapse;
}

.task-table th {
    text-align: left;
    padding: 14px 12px 10px 0;
    border-bottom: 1px solid var(--border-strong);
    font-weight: 400;
}

.task-table th.num,
.task-table td.num {
    text-align: right;
}

.task-table th a {
    text-decoration: none;
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.task-table th a.active {
    color: var(--text);
    font-weight: 600;
}

.task-table td {
    padding: 14px 12px 14px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 16px;
    vertical-align: top;
}

.task-table td.title {
    font-weight: 600;
    line-height: 1.35;
}

.task-table td.nowrap {
    white-space: nowrap;
}

.task-table .check {
    width: 44px;
    padding: 14px 8px 14px 0;
}

.task-table tr:has(input:checked) {
    background: var(--bg-selected);
}

.task-table .critical {
    color: var(--accent);
    font-weight: 600;
}

.task-table .none {
    color: var(--text-muted);
}

.task-table input[type='checkbox'] {
    appearance: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1px solid var(--text);
    border-radius: 0;
    background: var(--bg-surface);
    cursor: pointer;
    display: block;
}

.task-table input[type='checkbox']:checked {
    background: var(--accent-fill);
}

.table-foot {
    display: flex;
    gap: 32px;
    padding-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.table-foot strong {
    color: var(--text);
    font-weight: 600;
}

.table-empty {
    padding: 28px 0;
    font-size: 16px;
    color: var(--text-muted);
}

/* ===== Admin (stamdata — bevidst udesignet, kun læsbart) ===== */

.admin {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 36px;
    max-width: 720px;
}

.admin h2 {
    font-size: 20px;
    border-bottom: 1px solid var(--border-strong);
    padding-bottom: 8px;
}

.admin ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.admin li > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.admin-notes {
    display: block;
    margin-top: 2px;
    white-space: pre-line;
}

.admin form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 480px;
}

.admin form > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin input[type='text'],
.admin input[type='number'],
.admin select {
    height: 44px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: #fff;
    padding: 0 10px;
}

.admin .btn-primary {
    align-self: flex-start;
    height: 44px;
}

/* ===== Login ===== */

.login-page {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-form {
    width: 100%;
    max-width: 360px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form h1 {
    font-size: 22px;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-form input {
    height: 52px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: #fff;
    padding: 0 14px;
    font-size: 16px;
}

.login-error {
    margin: 0;
    color: var(--accent);
    font-weight: 600;
}

/* ===== Mobil-layout (skærm 1-3) ===== */

.app-mobile {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100dvh;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 96px;
}

.m-statusbar {
    padding: 18px 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
}

.m-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    text-decoration: none;
    min-height: 44px;
}

.m-header {
    padding: 14px 20px 12px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.m-header h2 {
    font-size: 26px;
}

.m-count {
    font-size: 13px;
    color: var(--text-muted);
}

.overline-sm {
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.m-hint {
    font-size: 13px;
    color: var(--text-muted);
}

/* Skærm 1: filterknapper + chips */

.m-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 20px 14px;
}

.m-filter-buttons {
    display: flex;
    gap: 8px;
}

.m-filter-btn {
    flex: 1;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
}

.m-filter-btn.set {
    background: var(--bg-selected);
    color: var(--accent);
    border-color: var(--accent-fill);
}

.m-chips {
    display: grid;
    gap: 8px;
}

.m-chips-3 {
    grid-template-columns: repeat(3, 1fr);
}

.m-chips-2 {
    grid-template-columns: repeat(2, 1fr);
}

.m-chip {
    min-height: 44px;
    padding: 10px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.m-chip.active {
    background: var(--accent-fill);
    color: #fff;
    border-color: var(--accent-fill);
}

/* Skærm 1: liste */

.m-list {
    flex: 1;
    border-top: 1px solid var(--border);
}

.m-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(43, 39, 36, 0.10);
    min-height: 44px;
    text-decoration: none;
}

.m-row-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.m-row-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.m-row-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.m-row-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    padding-top: 2px;
}

.m-prio {
    font-size: 13px;
    color: var(--text-muted);
}

.m-prio.critical {
    font-weight: 600;
    color: var(--accent);
}

.m-photo-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-muted);
}

.m-unsynced-dot {
    width: 7px;
    height: 7px;
    background: var(--accent-fill);
    display: inline-block;
}

.m-list-empty {
    padding: 32px 20px;
    font-size: 16px;
    color: var(--text-muted);
}

/* Skærm 1: tom tilstand */

.m-empty {
    flex: 1;
    border-top: 1px solid var(--border);
    padding: 48px 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.m-empty-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.m-empty-text {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 30ch;
    text-wrap: pretty;
}

.m-suggestions {
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(43, 39, 36, 0.10);
    margin-top: 8px;
}

.m-suggestions .overline-sm {
    padding: 14px 0 6px;
    text-transform: none;
    letter-spacing: normal;
}

.m-suggestions span:not(.overline-sm) {
    font-size: 16px;
    padding: 6px 0;
}

/* Bund-CTA i tommelrækkevidde */

.m-cta-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px 20px 24px;
    background: linear-gradient(to top, var(--bg-surface) 70%, rgba(250, 248, 245, 0));
    max-width: 430px;
    margin: 0 auto;
}

.m-cta {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent-fill);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.m-cta:hover {
    background: var(--accent-hover);
}

/* Skærm 3: titel + beskrivelse */

.m-head {
    padding: 10px 20px 18px;
    display: flex;
    flex-direction: column;
}

.m-head h2 {
    font-size: 26px;
    line-height: 1.2;
}

.m-editable {
    border-bottom: 1px dashed rgba(43, 39, 36, 0.22);
    padding-bottom: 6px;
    cursor: pointer;
}

.m-desc {
    margin: 14px 0 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-secondary);
    text-wrap: pretty;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.m-inline-form {
    padding: 10px 0 0;
}

.m-inline-form form,
.m-inline-form-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.m-inline-form input[type='text'],
.m-inline-form textarea,
.m-inline-form-row input[type='text'] {
    flex: 1;
    min-height: 52px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: #fff;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
}

.m-save {
    min-height: 52px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent-fill);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 0 16px;
    cursor: pointer;
}

.m-save:hover {
    background: var(--accent-hover);
}

.m-cancel {
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    font-size: 16px;
    color: var(--text-muted);
    text-decoration: none;
}

/* Skærm 3: metarækker */

.m-meta {
    border-top: 1px solid var(--border);
}

.m-meta-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
    padding: 8px 20px;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    background: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.m-meta-value {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: var(--text);
}

.m-meta-value .critical {
    color: var(--accent);
    font-weight: 600;
}

.m-meta-value svg {
    color: var(--text-placeholder);
}

.m-picker {
    padding: 6px 20px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface-alt);
}

.m-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-size: 16px;
    cursor: pointer;
}

.m-option input {
    accent-color: var(--accent-fill);
    width: 18px;
    height: 18px;
}

.m-meta-tags {
    align-items: flex-start;
    padding-top: 12px;
    padding-bottom: 12px;
    cursor: default;
}

.m-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.m-tag {
    font-size: 13px;
    padding: 6px 10px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
}

.m-tag-add {
    font-size: 13px;
    padding: 6px 10px;
    border: 1px dashed rgba(43, 39, 36, 0.28);
    border-radius: var(--radius);
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* Skærm 3: billeder */

.m-section {
    padding: 22px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.m-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.m-photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.m-photo-thumb {
    aspect-ratio: 1;
    background: var(--neutral-300);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.m-photo-add {
    aspect-ratio: 1;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Skærm 3: dokumenter (pdf/xlsx/docx) — online-only, jf. brief §6 */

.m-files {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
}

.m-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    border-bottom: 1px solid var(--border);
}

.m-file-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 44px;
    padding: 10px 0;
    color: var(--text-primary);
    text-decoration: none;
}

.m-file-hide {
    border: none;
    background: none;
    padding: 10px 0 10px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.m-file-row svg {
    flex: 0 0 auto;
    color: var(--text-secondary);
}

.m-file-name {
    flex: 1 1 auto;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.m-file-meta {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.m-file-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    margin-top: 8px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
}

.m-hint-offline {
    display: none;
}

.is-offline .m-hint-online {
    display: none;
}

.is-offline .m-hint-offline {
    display: inline;
}

/* Skærm 3: materialer */

.m-materials {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
}

.m-material {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.m-material-check {
    flex: none;
}

.m-material-check label {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.m-material-check input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.m-checkbox {
    width: 20px;
    height: 20px;
    border: 1px solid var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    background: var(--bg-surface);
}

.m-checkbox.checked {
    background: var(--accent-fill);
    color: #fff;
    border-color: var(--accent-fill);
}

.m-material-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
}

.m-material-desc {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.m-material-desc.purchased {
    text-decoration: line-through;
}

.m-material-total {
    font-size: 16px;
    white-space: nowrap;
    padding-top: 1px;
}

.m-material-add {
    display: flex;
    align-items: center;
    min-height: 52px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 16px;
    color: var(--accent);
    text-decoration: none;
}

.m-material-edit {
    display: block;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.m-material-edit form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.m-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.m-field label {
    font-size: 13px;
    color: var(--text-muted);
}

.m-field input,
.m-field select {
    min-height: 44px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: #fff;
    padding: 0 10px;
    font-size: 16px;
    width: 100%;
}

.m-field-row {
    display: flex;
    gap: 8px;
}

.m-field-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.m-sum-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0 0 14px;
    font-size: 16px;
}

.m-sum-main {
    padding: 14px 0;
    font-weight: 600;
}

/* Skærm 3: noter */

.m-section-notes {
    padding-bottom: 26px;
}

.m-notes {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-strong);
    padding-left: 14px;
    gap: 16px;
}

.m-note {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.m-note-body {
    font-size: 16px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

/* Links i fritekst: forkortet etiket, men bryd alligevel frem for at vælte layoutet */
.m-link {
    color: var(--accent-fill);
    text-decoration: underline;
    overflow-wrap: anywhere;
}

.m-note-form-wrap {
    position: sticky;
    bottom: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 12px 20px 20px;
    margin-top: auto;
    display: block;
}

.m-note-form {
    display: flex;
    gap: 10px;
}

.m-note-form input[type='text'] {
    flex: 1;
    height: 52px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: #fff;
    padding: 0 14px;
    font-size: 16px;
}

.m-note-send {
    width: 56px;
    height: 52px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent-fill);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: none;
}

.m-note-send:hover {
    background: var(--accent-hover);
}

/* ===== Skærm 2 · Opret-arket (bottom sheet) ===== */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(43, 39, 36, 0.45);
    z-index: 40;
}

.m-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 430px;
    margin: 0 auto;
    max-height: 92dvh;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-strong);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.m-sheet-saved {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--text);
    color: var(--bg-surface-alt);
    font-size: 16px;
    font-weight: 600;
}

.m-sheet-saved-dot {
    width: 7px;
    height: 7px;
    background: var(--warm-300);
    display: inline-block;
}

.m-sheet-saved a {
    margin-left: auto;
    color: var(--warm-300);
    font-weight: 400;
}

.m-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 0;
}

.m-sheet-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.m-sheet-close {
    width: 44px;
    height: 44px;
    border: none;
    background: none;
    font-size: 26px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}

.m-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.m-sheet-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.m-sheet-field input[type='text'],
.m-sheet-field select {
    height: 52px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: #fff;
    padding: 0 14px;
    font-size: 16px;
}

.m-chips-4 {
    grid-template-columns: repeat(4, 1fr);
}

.m-chip-radio {
    position: relative;
    cursor: pointer;
}

.m-chip-radio input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.m-chip-radio:has(input:checked) {
    background: var(--accent-fill);
    color: #fff;
    border-color: var(--accent-fill);
}

.m-sheet-photos {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.m-sheet-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.m-sheet-thumbs img {
    aspect-ratio: 1;
    width: 100%;
    object-fit: cover;
    display: block;
}

.m-sheet-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 44px;
    border: none;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    background: none;
    font-size: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.m-sheet-more-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.m-sheet-stay {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-size: 16px;
    cursor: pointer;
}

.m-sheet-stay input {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-fill);
}

.m-sheet-round {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-subtle);
}

.m-sheet-round .overline-sm {
    padding: 12px 0 4px;
}

.m-sheet-round-list {
    display: flex;
    flex-direction: column;
}

.m-sheet-round-list span {
    font-size: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.m-sheet-actions {
    display: flex;
    gap: 10px;
    padding: 18px 20px 24px;
}

.m-sheet-camera {
    width: 56px;
    height: 56px;
    flex: none;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.m-sheet-save {
    flex: 1;
}

.m-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== Milepæl 7 · offline, kø-status og bannere ===== */

button.sync-status {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
}

.m-banner {
    margin: 10px 20px 0;
    padding: 12px 14px;
    background: var(--bg-selected);
    border: 1px solid var(--accent-fill);
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.45;
    color: var(--accent);
}

.m-banner button {
    border: none;
    background: none;
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    padding: 0 4px;
}

.m-banner-offline {
    background: var(--bg-surface-alt);
    border-color: var(--border-strong);
    color: var(--text-secondary);
}

.m-row-queued {
    background: var(--bg-surface-alt);
}

/* Ærlig degradering: felterne må ikke fejle stille — de er synligt inaktive */
.is-offline .m-head .m-editable,
.is-offline .m-head .m-inline-form,
.is-offline .m-meta,
.is-offline .m-materials .m-material,
.is-offline .m-material-add,
.is-offline .m-note-form-wrap,
.is-offline .offline-disables {
    pointer-events: none;
    opacity: 0.55;
}

.m-photo-thumb-local {
    position: relative;
}

.m-photo-thumb-local::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    background: var(--accent-fill);
}

/* ===== Desktop-navigation: ind i en opgave, og opret derfra ===== */

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-new {
    height: 40px;
    font-size: 15px;
}

.row-link {
    color: inherit;
    text-decoration: none;
}

.row-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.task-table tbody tr:hover {
    background: var(--bg-surface-alt);
}

.panel-item .row-link {
    min-width: 0;
}

/* Detaljesiden er den samme som på telefonen — den får bare luft omkring sig
   inde i desktop-rammen, og fylder ikke hele bredden ud (linjelængde). */
.task-detail-desktop {
    max-width: 720px;
    margin: 0 auto;
    padding: 8px 32px 48px;
}

/* Opret-arket er en bundsheet på telefonen; på PC er der ingen tommelfinger
   at tage hensyn til, så det står som en centreret dialog. */
@media (min-width: 761px) {
    .app-desktop .m-sheet {
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        max-width: 520px;
        max-height: 86dvh;
        border: 1px solid var(--border-strong);
    }
}

/* ===== Desktop-siderne på en smal skærm =====
   Overblik, Opgaver og Stamdata er tegnet til PC, men skal kunne bruges på
   telefonen: navigationen foldes ind bag en burger-knap, og indholdet stables. */

.topbar-burger {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
}

.topbar-burger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
}

.topbar-nav-narrow {
    display: none;
}

/* Samme burger-menu i statusbaren på mobilsiderne (opgaveliste, opgave, el) */
.m-statusbar {
    position: relative;
    gap: 12px;
}

.m-statusbar .sync-status {
    margin-left: auto;
}

.m-statusbar-title {
    font-size: 16px;
    font-weight: 600;
}

.m-menu {
    margin-left: auto;
}

.m-statusbar .sync-status + .m-menu {
    margin-left: 0;
}

.m-menu .topbar-burger {
    display: inline-flex;
}

.m-menu-nav {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 40;
    flex-direction: column;
    padding: 0 20px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-strong);
    border-bottom: 1px solid var(--border-strong);
    box-shadow: 0 12px 24px rgb(0 0 0 / 12%);
}

.menu-open .m-menu-nav {
    display: flex;
}

.m-menu-nav a {
    padding: 14px 0;
    font-size: 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-subtle);
}

.m-menu-nav a:last-child {
    border-bottom: none;
}

.m-menu-nav .active {
    color: var(--text);
    font-weight: 600;
    padding-left: 12px;
    box-shadow: inset 3px 0 0 var(--accent-fill);
}

@media (max-width: 760px) {
    .topbar-nav-narrow {
        display: block;
    }

    .app-desktop {
        margin: 0;
        border: none;
        min-height: 100dvh;
    }

    .topbar {
        position: relative;
        flex-wrap: wrap;
        gap: 10px 12px;
        padding: 10px 16px;
    }

    .topbar-left {
        margin-right: auto;
    }

    /* Knapperne bliver topbarens egne flex-børn, så synk-status kan få sin egen linje */
    .topbar-right {
        display: contents;
    }

    .topbar-burger {
        display: inline-flex;
    }

    .topbar-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 40;
        flex-direction: column;
        gap: 0;
        padding: 0 16px;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-strong);
        border-bottom: 1px solid var(--border-strong);
        box-shadow: 0 12px 24px rgb(0 0 0 / 12%);
    }

    .topbar.menu-open .topbar-nav {
        display: flex;
    }

    .topbar-nav a,
    .topbar-nav .active {
        padding: 14px 0;
        border-bottom: 1px solid var(--border-subtle);
    }

    .topbar-nav a:last-child {
        border-bottom: none;
    }

    .topbar-nav .active {
        box-shadow: inset 3px 0 0 var(--accent-fill);
        padding-left: 12px;
    }

    /* "Alt synkroniseret" fylder for meget i én linje; kun prikken vises, indtil
       noget venter — så får beskeden hele bredden under topbaren. */
    .topbar .sync-status:not(.pending) [data-sync-status-target='label'] {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .topbar .sync-status.pending {
        order: 5;
        flex-basis: 100%;
        text-align: left;
    }

    .overview {
        grid-template-columns: minmax(0, 1fr);
    }

    .overview-left {
        padding: 24px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        min-height: 0;
    }

    .overview-right {
        padding: 24px 16px;
    }

    .overview-head {
        flex-direction: column;
        gap: 6px;
    }

    /* Etape-rækken: navnet på egen linje, de tre tal under med hver sin etiket */
    .phase-grid-head {
        display: none;
    }

    .phase-grid {
        grid-template-columns: 0.7fr 1fr 1fr;
        gap: 10px 12px;
    }

    .phase-grid > :first-child {
        grid-column: 1 / -1;
    }

    .phase-grid .num {
        text-align: left;
    }

    .phase-grid .num::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    .filter-bar {
        padding: 16px;
    }

    .filter-bar label:not(.filter-toggle) {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
    }

    .filter-bar select {
        min-width: 0;
        width: 100%;
    }

    .filter-count {
        flex-basis: 100%;
        margin-left: 0;
        padding-bottom: 0;
    }

    .bulk-bar {
        flex-wrap: wrap;
        gap: 10px 16px;
        padding: 12px 16px;
    }

    .bulk-bar select {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* Tabellen har ti kolonner og må rulle vandret inde i sin egen ramme —
       siden selv bliver aldrig bredere end skærmen. */
    .table-wrap {
        padding: 0 0 24px 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .task-table td.title {
        min-width: 180px;
    }

    .table-foot {
        position: sticky;
        left: 0;
        flex-direction: column;
        gap: 6px;
        padding-right: 16px;
    }

    .admin {
        padding: 24px 16px;
        gap: 28px;
    }

    .task-detail-desktop {
        padding: 0 0 48px;
    }
}
