:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #18202a;
    --muted: #6c7683;
    --line: #e3e7eb;
    --black: #1c232b;

    --green: #16835c;
    --green-bg: #eaf7f1;

    --orange: #b86b0f;
    --orange-bg: #fff4e5;

    --red: #c64040;
    --red-bg: #fff0f0;

    --blue: #316bb4;
    --blue-bg: #eef5ff;

    --radius: 18px;
    --shadow:
        0 8px 28px
        rgba(28, 35, 43, 0.06);
}


/* ==========================================
   BASE
========================================== */

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;

    background: var(--bg);
    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans JP",
        sans-serif;
}

button,
a {
    font: inherit;
}

button {
    appearance: none;
    -webkit-appearance: none;
}

a {
    color: inherit;
    text-decoration: none;
}

.dashboard {
    width: min(
        1440px,
        calc(100% - 40px)
    );

    margin: 0 auto;
    padding: 24px 0 48px;
}

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);

    background: var(--card);

    box-shadow: var(--shadow);
}


/* ==========================================
   TYPOGRAPHY
========================================== */

.brand-label,
.section-label {
    margin: 0;

    color: var(--muted);

    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.11em;
}

.section-title {
    margin: 4px 0 0;

    font-size: 22px;
    line-height: 1.3;
}


/* ==========================================
   HEADER
========================================== */

.topbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;

    margin-bottom: 24px;

    border-bottom:
        1px solid var(--line);
}

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

    padding-bottom: 18px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 16px;

    min-width: 0;
}

.brand-logo {
    display: block;

    width: 62px;
    height: 62px;

    flex: 0 0 auto;

    object-fit: contain;

    border-radius: 10px;
}

.brand-block .brand-label {
    margin-bottom: 4px;

    font-size: 11px;
}

.brand-title {
    margin: 0;

    font-size: 30px;
    line-height: 1.1;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 12px;

    flex: 0 0 auto;

    color: var(--muted);

    font-size: 13px;
}

.system-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 8px 12px;

    border:
        1px solid #cde7db;
    border-radius: 999px;

    background: var(--green-bg);
    color: var(--green);

    font-weight: 700;
    white-space: nowrap;
}

.system-dot {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: var(--green);
}


/* ==========================================
   APP LAUNCHER
========================================== */

.app-launcher {
    display: flex;
    align-items: center;
    gap: 8px;

    margin: 0;
    padding: 12px 0;

    overflow-x: auto;
}

.app-launcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 40px;
    padding: 9px 15px;

    flex: 0 0 auto;

    border:
        1px solid var(--line);
    border-radius: 10px;

    background: #ffffff;
    color: var(--text);

    font-size: 13px;
    font-weight: 750;
    white-space: nowrap;

    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        transform 0.16s ease,
        box-shadow 0.16s ease;
}

.app-launcher a:hover {
    border-color: #cfd5db;

    background: #f7f8fa;

    transform:
        translateY(-1px);

    box-shadow:
        0 5px 14px
        rgba(28, 35, 43, 0.07);
}

.app-launcher a:first-child {
    border-color: var(--black);

    background: var(--black);
    color: #ffffff;
}


/* ==========================================
   COMMON SECTION
========================================== */

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 18px;
}

.count-badge {
    padding: 7px 11px;

    border-radius: 999px;

    background: var(--black);
    color: #ffffff;

    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}


/* ==========================================
   TODAY'S TODO
========================================== */

.todo-card {
    margin-bottom: 20px;
    padding: 24px;
}

.todo-list {
    display: grid;
    gap: 10px;
}

.todo-item {
    display: grid;

    grid-template-columns:
        30px
        34px
        minmax(0, 1fr)
        auto;

    align-items: center;
    column-gap: 12px;

    min-height: 74px;
    padding: 14px 16px;

    border:
        1px solid var(--line);
    border-radius: 13px;

    background: #ffffff;

    transition:
        background 0.16s ease,
        opacity 0.16s ease;
}

.todo-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    grid-column: 1;

    width: 28px;
    height: 28px;
    min-width: 28px;

    margin: 0;
    padding: 0;

    border:
        2px solid #7c8794;
    border-radius: 50%;

    background: #ffffff;
    color: transparent;

    box-shadow:
        0 1px 3px
        rgba(28, 35, 43, 0.12);

    cursor: pointer;

    font-size: 14px;
    font-weight: 900;
    line-height: 1;

    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease;
}

.todo-check:hover {
    border-color: var(--black);

    background: #f4f6f8;

    transform: scale(1.05);
}

.todo-number {
    grid-column: 2;

    color: var(--muted);

    font-size: 13px;
    font-weight: 800;

    text-align: center;
    white-space: nowrap;
}

.todo-content {
    grid-column: 3;

    min-width: 0;
}

.todo-title {
    margin: 0 0 3px;

    font-weight: 750;
    line-height: 1.45;

    word-break: normal;
    overflow-wrap: break-word;
}

.todo-note {
    margin: 0;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.5;

    word-break: normal;
    overflow-wrap: break-word;
}

.todo-time {
    grid-column: 4;

    min-width: 50px;

    color: var(--muted);

    font-size: 13px;
    font-weight: 700;

    text-align: right;
    white-space: nowrap;
}

.todo-item.is-complete {
    background: #f7f8fa;

    opacity: 0.65;
}

.todo-item.is-complete .todo-check {
    border-color: var(--black);

    background: var(--black);
    color: #ffffff;
}

.todo-item.is-complete .todo-title {
    text-decoration: line-through;
}

.todo-item.is-complete .todo-note,
.todo-item.is-complete .todo-time {
    color: #9aa2ab;
}


/* ==========================================
   KPI METRICS
========================================== */

.metric-grid {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 14px;

    margin-bottom: 20px;
}

.metric-card {
    padding: 20px;
}

.metric-label {
    margin: 0 0 12px;

    color: var(--muted);

    font-size: 13px;
    font-weight: 700;
}

.metric-value {
    margin: 0;

    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.metric-unit {
    margin-left: 4px;

    font-size: 14px;
}

.metric-note {
    margin: 10px 0 0;

    font-size: 12px;
    font-weight: 700;
}

.good {
    color: var(--green);
}

.caution {
    color: var(--orange);
}

.info {
    color: var(--blue);
}


/* ==========================================
   MAIN GRID
========================================== */

.main-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1.45fr)
        minmax(320px, 0.85fr);

    gap: 16px;

    margin-bottom: 20px;
}


/* ==========================================
   AI MORNING BRIEF
========================================== */

.ai-card {
    position: relative;

    overflow: hidden;

    padding: 26px;
}

.ai-card::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;

    width: 5px;
    height: 100%;

    background: var(--black);
}

.ai-heading {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ai-icon {
    display: grid;
    place-items: center;

    width: 44px;
    height: 44px;

    flex: 0 0 auto;

    border-radius: 13px;

    background: var(--black);
    color: #ffffff;

    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.ai-message {
    margin: 22px 0 20px;
    padding: 18px 20px;

    border:
        1px solid var(--line);
    border-radius: 14px;

    background: #f7f8fa;
    color: #3e4854;

    font-size: 14px;
    line-height: 1.85;
}

.ai-message p {
    margin: 0;
}

.ai-message p + p {
    margin-top: 12px;
}

.action-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    color: var(--black);

    font-size: 13px;
    font-weight: 800;
}

.ai-card .action-link {
    justify-content: center;

    min-height: 40px;
    padding: 9px 15px;

    border-radius: 10px;

    background: var(--black);
    color: #ffffff;

    transition:
        transform 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease;
}

.ai-card .action-link:hover {
    background: #303842;

    transform:
        translateY(-1px);

    box-shadow:
        0 6px 16px
        rgba(28, 35, 43, 0.13);
}


/* ==========================================
   FACILITY STATUS
========================================== */

.facility-card {
    padding: 24px;
}

.facility-list {
    display: grid;
    gap: 10px;
}

.facility-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding: 14px 0;

    border-bottom:
        1px solid var(--line);
}

.facility-row:last-child {
    border-bottom: 0;
}

.facility-name {
    margin: 0 0 3px;

    font-weight: 800;
}

.facility-area {
    margin: 0;

    color: var(--muted);

    font-size: 12px;
}

.status-chip {
    padding: 7px 10px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.status-checkin {
    background: var(--blue-bg);
    color: var(--blue);
}

.status-cleaning {
    background: var(--orange-bg);
    color: var(--orange);
}


/* ==========================================
   FOOTER
========================================== */

.footer {
    margin-top: 30px;

    color: var(--muted);

    font-size: 11px;
    text-align: center;
}


/* ==========================================
   TABLET
========================================== */

@media (max-width: 980px) {
    .metric-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

    .main-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 760px) {
    .header-main {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .brand-logo {
        width: 52px;
        height: 52px;
    }

    .brand-title {
        font-size: 26px;
    }

    .topbar-meta {
        width: 100%;

        justify-content: space-between;
    }

    .app-launcher {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .dashboard {
        width: min(
            100% - 24px,
            1440px
        );

        padding-top: 18px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .todo-card {
        padding: 20px 16px;
    }

    .todo-item {
        grid-template-columns:
            28px
            30px
            minmax(0, 1fr);

        grid-template-rows:
            auto
            auto;

        column-gap: 10px;
    }

    .todo-check {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .todo-number {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .todo-content {
        grid-column: 3;
        grid-row: 1;
    }

    .todo-time {
        grid-column: 3;
        grid-row: 2;

        margin-top: 4px;

        text-align: left;
    }

    .ai-card {
        padding: 22px 20px;
    }

    .ai-message {
        padding: 16px;
    }

    .ai-card .action-link {
        width: 100%;
    }
}