:root {
    color-scheme: dark;
    --background-color: #0c101b;
    --tile-bg: rgba(13, 18, 31, 0.75);
    --tile-border: rgba(255, 255, 255, 0.08);
    --tile-hover: rgba(255, 255, 255, 0.05);
    --accent: #4cc2ff;
    --text-primary: #f5f7fa;
    --text-secondary: rgba(245, 247, 250, 0.7);
    --success: #32d583;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    background: var(--background-color);
    color: var(--text-primary);
}

body {
    position: relative;
    overflow: hidden;
}

.background {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 15% 20%, rgba(96, 110, 140, 0.5), transparent 55%),
        radial-gradient(circle at 80% 70%, rgba(60, 75, 110, 0.45), transparent 48%),
        linear-gradient(135deg, rgba(20, 24, 40, 0.9), rgba(12, 14, 24, 0.9));
    filter: blur(120px);
    opacity: 0.9;
    z-index: -2;
    transition: background 1s ease;
    pointer-events: none;
}

.background::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 20, 0.35);
}

.page-header {
    position: sticky;
    top: 0;
    backdrop-filter: blur(18px);
    background: linear-gradient(90deg, rgba(12, 16, 27, 0.8), rgba(12, 16, 27, 0.5));
    border-bottom: 1px solid var(--tile-border);
    padding: 20px clamp(20px, 4vw, 48px);
    z-index: 2;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.branding {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 20px rgba(76, 194, 255, 0.7);
}

.page-layout {
    display: grid;
    grid-template-columns: clamp(260px, 22vw, 320px) minmax(0, 1fr);
    gap: 36px;
    padding: clamp(24px, 5vw, 64px);
    align-items: start;
}

.page-main {
    padding: 0;
}

.grid-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(280px, 22vw, 340px);
    gap: 32px;
    align-items: start;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns, 4), minmax(0, 1fr));
    gap: var(--grid-gap, 16px);
    transition: transform 0.2s ease;
}

.tile {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 18px;
    padding: 20px;
    background: var(--tile-bg);
    border: 1px solid var(--tile-border);
    border-radius: 18px;
    text-decoration: none;
    color: inherit;
    cursor: grab;
    min-height: 110px;
    position: relative;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}


.tile-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.65);
    display: grid;
    place-items: center;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.tile-remove:hover {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.9);
}

.tile-remove:active {
    transform: scale(0.9);
}

.tile-grid:not(.drag-locked) .tile-remove {
    opacity: 1;
    pointer-events: auto;
}

.tile:focus,
.tile:hover {
    background: var(--tile-hover);
    border-color: rgba(76, 194, 255, 0.4);
}

.tile:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.tile.is-dragging {
    opacity: 0.7;
    border-style: dashed;
}

.tile::after {
    content: attr(data-index);
    position: absolute;
    top: 12px;
    right: 16px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    opacity: 0.5;
}

.tile-body h3 {
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.tile-body p {
    margin: 8px 0 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.tile-favicon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.tile-favicon::after {
    content: '';
    width: 32px;
    height: 32px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-image: var(--favicon-url, none);
    border-radius: 8px;
}

.widgets {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.widget {
    background: var(--tile-bg);
    border: 1px solid var(--tile-border);
    border-radius: 18px;
    padding: 22px;
    backdrop-filter: blur(12px);
}

.widget header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.widget h2 {
    margin: 0;
    font-size: 1.05rem;
}

.widget-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.load-body {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.gauge {
    display: grid;
    gap: 12px;
    text-align: center;
    position: relative;
}

.gauge::after {
    content: attr(data-label);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.gauge-dial {
    aspect-ratio: 1;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--progress, 0) * 1deg), rgba(255, 255, 255, 0.06) 0deg);
    display: grid;
    place-items: center;
    border: 1px solid rgba(76, 194, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.gauge-dial::after {
    content: '';
    position: absolute;
    inset: 14%;
    border-radius: 50%;
    background: rgba(12, 16, 27, 0.9);
}

.gauge-value {
    position: relative;
    z-index: 1;
    font-variant-numeric: tabular-nums;
}

.visitors-total-only {
    text-align: center;
}

.visitors-total-label {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.timestamp {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
}

@media (max-width: 1080px) {
    .grid-wrapper {
        grid-template-columns: 1fr;
    }

    .widgets {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .widget {
        flex: 1 1 280px;
    }
}

@media (max-width: 720px) {
    .tile {
        grid-template-columns: 48px 1fr;
        padding: 16px;
    }

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


.settings-button,
.lock-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.settings-button:hover,
.lock-button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.settings-button:active,
.lock-button:active {
    transform: scale(0.98);
}

.settings-icon {
    font-size: 1.15rem;
}

.lock-icon {
    font-size: 1.15rem;
}

.lock-button.is-unlocked {
    background: rgba(76, 194, 255, 0.18);
    border-color: rgba(76, 194, 255, 0.35);
    color: var(--accent);
}

.lock-button.is-unlocked:hover {
    background: rgba(76, 194, 255, 0.26);
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 50;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 7, 15, 0.75);
    backdrop-filter: blur(6px);
}

.modal-dialog {
    position: relative;
    width: min(720px, 92vw);
    max-height: 90vh;
}

.modal-content {
    background: rgba(12, 16, 27, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.45);
}

.modal-header,
.modal-footer {
    padding: 20px 28px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    display: grid;
    gap: 24px;
}

.modal-section {
    display: grid;
    gap: 16px;
}

.modal-section h3 {
    margin: 0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.7);
}

.modal-section label {
    display: grid;
    gap: 8px;
    font-size: 0.9rem;
}

.modal-section input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(5, 7, 15, 0.7);
    color: inherit;
    font-size: 0.95rem;
}

.modal-section input:focus {
    outline: none;
    border-color: rgba(76, 194, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(76, 194, 255, 0.18);
}

.modal-close {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px 10px;
}

.primary,
.secondary,
.danger {
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary {
    background: linear-gradient(135deg, rgba(76, 194, 255, 0.9), rgba(55, 135, 255, 0.9));
    border-color: rgba(76, 194, 255, 0.6);
    color: #0b0f18;
    font-weight: 600;
}

.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(76, 194, 255, 0.35);
}

.secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: inherit;
}

.secondary:hover {
    transform: translateY(-1px);
}

.danger {
    background: rgba(249, 112, 102, 0.18);
    border-color: rgba(249, 112, 102, 0.5);
    color: #fda29b;
}

.tile-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(5, 7, 15, 0.6);
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
    cursor: grab;
}

.tile-row:active {
    cursor: grabbing;
}

.tile-row.dragging {
    opacity: 0.65;
    border-style: solid;
    border-color: rgba(76, 194, 255, 0.35);
}

.tile-row-handle {
    font-size: 1.4rem;
    line-height: 1;
    padding-top: 4px;
    color: rgba(255, 255, 255, 0.45);
}

.tile-row-fields {
    display: grid;
    gap: 12px;
}

.tile-row-fields label span {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tiles-editor {
    display: block;
}

.tiles-editor:empty::after {
    content: 'Nog geen tegels. Voeg er een toe.';
    display: block;
    text-align: center;
    padding: 24px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tile-row-remove {
    border-radius: 999px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.grid-inputs {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

@media (max-width: 640px) {
    .modal-dialog {
        width: 96vw;
    }

    .modal-body {
        padding: 20px;
    }
}


.tile-grid.drag-locked .tile {
    cursor: pointer;
}

.tile-grid.drag-locked .tile::after {
    opacity: 0.25;
}

.tile.is-locked {
    cursor: pointer;
}

.tile.is-locked:active {
    transform: none;
}


.task-sidebar {
    background: rgba(13, 18, 31, 0.78);
    border: 1px solid var(--tile-border);
    border-radius: 20px;
    padding: 24px;
    display: grid;
    gap: 24px;
    position: relative;
    overflow: hidden;
}

.task-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.task-header p {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.task-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 16px;
}

.task-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    display: grid;
    gap: 12px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.task-card.is-empty {
    text-align: center;
    color: var(--text-secondary);
    border-style: dashed;
    background: rgba(255, 255, 255, 0.02);
    pointer-events: none;
}

.task-card-body h3 {
    margin: 0;
    font-size: 1.05rem;
}

.task-card-body p {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.task-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.task-card.is-due {
    border-color: rgba(249, 112, 102, 0.55);
    background: rgba(249, 112, 102, 0.12);
}

.task-card.is-due .task-card-meta time {
    color: var(--danger);
    font-weight: 600;
}

.task-remove {
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.task-remove:hover {
    background: rgba(249, 112, 102, 0.3);
    color: var(--danger);
}

.task-remove:active {
    transform: scale(0.9);
}

.task-form {
    display: grid;
    gap: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 20px;
}

.task-form h3 {
    margin: 0;
    font-size: 1.02rem;
}

.task-form label {
    display: grid;
    gap: 6px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.6);
}

.task-form input,
.task-form textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(5, 7, 15, 0.7);
    color: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.task-form input:focus,
.task-form textarea:focus {
    outline: none;
    border-color: rgba(76, 194, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(76, 194, 255, 0.18);
}

.task-submit {
    justify-self: start;
}

@media (max-width: 1080px) {
    .page-layout {
        grid-template-columns: 1fr;
    }

    .task-sidebar {
        order: 2;
    }

    .page-main {
        order: 1;
    }
}
