:root {
    --win-gray: #c0c0c0;
    --win-dark: #808080;
    --win-darker: #404040;
    --win-light: #ffffff;
    --win-blue: #000080;
    --win-blue2: #1084d0;
    --text: #000000;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
    font-size: 16px;
    background: #008080;
    color: var(--text);
}

body {
    padding: 10px;
}

a { color: #000080; }

.desktop {
    min-height: calc(100vh - 20px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.window {
    background: var(--win-gray);
    border-top: 2px solid var(--win-light);
    border-left: 2px solid var(--win-light);
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    box-shadow: 1px 1px 0 var(--win-dark);
}

.main-window {
    width: min(1100px, 100%);
}

.title-bar {
    margin: 2px;
    padding: 4px 5px;
    color: white;
    background: linear-gradient(90deg, var(--win-blue), var(--win-blue2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: bold;
}

.title-bar-controls {
    display: flex;
    gap: 2px;
}

.title-bar-controls button {
    width: 24px;
    height: 22px;
    padding: 0;
    font-weight: bold;
}

.menu-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border-bottom: 1px solid var(--win-dark);
}

.menu-bar a {
    color: black;
    text-decoration: none;
    padding: 6px 10px;
}

.menu-bar a:active {
    border-top: 1px solid var(--win-dark);
    border-left: 1px solid var(--win-dark);
    border-right: 1px solid white;
    border-bottom: 1px solid white;
}

.window-body {
    padding: 14px;
}

.status-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px;
    padding: 4px;
}

.status-bar > div {
    border-top: 1px solid var(--win-dark);
    border-left: 1px solid var(--win-dark);
    border-right: 1px solid white;
    border-bottom: 1px solid white;
    padding: 4px 6px;
    font-size: 13px;
}

h1 {
    font-size: 24px;
    margin: 4px 0 14px;
}

fieldset {
    margin: 0 0 14px;
    padding: 14px;
    border-top: 2px solid var(--win-dark);
    border-left: 2px solid var(--win-dark);
    border-right: 2px solid white;
    border-bottom: 2px solid white;
}

legend {
    padding: 0 7px;
    font-weight: bold;
}

label {
    display: block;
    margin: 10px 0 5px;
    font-weight: bold;
}

input, select, textarea {
    width: 100%;
    min-height: 42px;
    padding: 8px;
    font: inherit;
    color: black;
    background: white;
    border-top: 2px solid #404040;
    border-left: 2px solid #404040;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
    border-radius: 0;
}

textarea { resize: vertical; }

button, .button {
    display: inline-block;
    min-height: 42px;
    padding: 9px 14px;
    font: inherit;
    font-weight: bold;
    color: black;
    text-decoration: none;
    text-align: center;
    background: var(--win-gray);
    border-top: 2px solid white;
    border-left: 2px solid white;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    cursor: pointer;
}

button:active, .button:active {
    border-top: 2px solid #000;
    border-left: 2px solid #000;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
}

.primary {
    outline: 2px solid var(--win-blue);
    outline-offset: -5px;
}

.danger {
    font-weight: bold;
}

.button-stack {
    display: grid;
    gap: 9px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

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

.inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline input[type="number"] {
    max-width: 150px;
}

.inline input[type="checkbox"] {
    width: 22px;
    min-height: 22px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-weight: normal;
}

.big-value {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
}

.hint {
    font-size: 13px;
    margin-top: 6px;
}

.message {
    margin-bottom: 12px;
    padding: 10px;
    border: 2px inset white;
    background: #ffffcc;
}

.message.success { background: #dfffdf; }
.message.error { background: #ffdede; }

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th, td {
    padding: 8px;
    border: 1px solid #808080;
    white-space: nowrap;
}

th {
    background: var(--win-gray);
    text-align: left;
}

.heading-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.summary-box {
    margin-bottom: 14px;
    padding: 10px;
    background: #ffffcc;
    border: 2px inset white;
}

.months {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.month { min-width: 0; }

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(55px, 1fr));
    gap: 4px;
}

.day-cell {
    min-height: 78px;
    padding: 5px;
    text-decoration: none;
    color: black;
    background: #ecf0f1;
    border-top: 2px solid white;
    border-left: 2px solid white;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
}

.day-cell.has-entry {
    color: white;
}

/* Farben identisch zur Windows-PC-Jahresmatrix */
.day-cell.cat-arbeit { background: #229954; color: white; }
.day-cell.cat-urlaub { background: #2980b9; color: white; }
.day-cell.cat-frei { background: #7f8c8d; color: white; }
.day-cell.cat-krank { background: #c0392b; color: white; }
.day-cell.cat-feiertag { background: #8e44ad; color: white; }

.matrix-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px 14px;
    margin: -4px 0 12px;
    padding: 7px 9px;
    border-top: 2px solid #808080;
    border-left: 2px solid #808080;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.legend-color {
    display: inline-block;
    width: 22px;
    height: 18px;
    border-top: 1px solid white;
    border-left: 1px solid white;
    border-right: 1px solid #404040;
    border-bottom: 1px solid #404040;
}

.legend-arbeit { background: #229954; }
.legend-urlaub { background: #2980b9; }
.legend-frei { background: #7f8c8d; }
.legend-krank { background: #c0392b; }
.legend-feiertag { background: #8e44ad; }

.day-number {
    display: block;
    font-weight: bold;
}

.weekday {
    display: block;
    font-size: 12px;
}

.day-info {
    display: block;
    margin-top: 5px;
    font-size: 13px;
}

@media (max-width: 760px) {
    body { padding: 0; background: var(--win-gray); }

    .desktop { min-height: 100vh; }

    .main-window {
        width: 100%;
        min-height: 100vh;
        border-left: 0;
        border-right: 0;
    }

    .window-body { padding: 10px; }

    .grid.two, .months {
        grid-template-columns: 1fr;
    }

    .menu-bar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .menu-bar a {
        border-top: 2px solid white;
        border-left: 2px solid white;
        border-right: 2px solid #000;
        border-bottom: 2px solid #000;
        text-align: center;
        min-height: 42px;
    }

    .matrix-grid {
        grid-template-columns: repeat(7, minmax(42px, 1fr));
        gap: 2px;
    }

    .matrix-legend {
        justify-content: flex-start;
        gap: 7px 10px;
    }

    .day-cell {
        min-height: 68px;
        padding: 3px;
    }

    .day-info { font-size: 11px; }
    .weekday { font-size: 10px; }

    .inline {
        align-items: flex-start;
        flex-direction: column;
    }

    .inline input[type="number"] {
        max-width: 100%;
    }

    .button-row > * {
        flex: 1 1 100%;
    }
}


/* v1.5 – Dashboard näher an der PC-Version */
.balance { font-size: 24px; font-weight: bold; margin-top: 6px; }
.balance.positive { color: #0000cc; }
.balance.negative { color: #800000; }
.month-select { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.month-select label { margin: 0; }
.month-select select { width: auto; min-width: 170px; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.metric-card {
    min-width: 0; padding: 10px; text-align: center; background: var(--win-gray);
    border-top: 2px solid white; border-left: 2px solid white;
    border-right: 2px solid #808080; border-bottom: 2px solid #808080;
}
.metric-card strong { display: block; font-size: 18px; }
.metric-sub { display: block; font-size: 12px; margin-top: 4px; }
.metric-value { display: block; font-size: 25px; font-weight: bold; margin: 9px 0; }
@media (max-width: 900px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .metric-grid { grid-template-columns: 1fr; } .month-select { align-items: stretch; flex-direction: column; } .month-select select { width: 100%; } }


/* v1.6 – Öffentlicher Arbeitsplan & Login */
.public-plan-hint {
    margin: -5px 0 14px;
    padding: 8px;
    background: #ffffcc;
    border-top: 2px solid #808080;
    border-left: 2px solid #808080;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
}
.plan-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.plan-fieldset { min-width: 0; }
.receipt-shell {
    overflow-x: auto;
    padding: 12px;
    background: #808080;
    border-top: 2px solid #404040;
    border-left: 2px solid #404040;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
}
.shift-receipt {
    width: fit-content;
    min-width: min(100%, 390px);
    margin: 0 auto;
    padding: 18px 14px 26px;
    background: #ffffff;
    color: #000000;
    font-family: "Courier New", Consolas, monospace;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre;
    border: 1px solid #b0b0b0;
    box-shadow: 2px 2px 0 #404040;
}
.public-login-area {
    margin: 18px auto 4px;
    max-width: 520px;
    padding: 14px;
    text-align: center;
    border-top: 2px solid #808080;
    border-left: 2px solid #808080;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
}
.public-login-area .hint { margin: 0 0 10px; }
.login-button { min-width: 190px; margin: 4px; }
.login-panel { max-width: 520px; margin: 20px auto; }

@media (max-width: 760px) {
    .plan-grid { grid-template-columns: 1fr; }
    .receipt-shell { padding: 8px 4px; }
    .shift-receipt {
        min-width: 358px;
        padding: 14px 8px 22px;
        font-size: 12px;
    }
    .login-button { width: 100%; margin: 4px 0; }
}
