* {
    box-sizing: border-box;
}


:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #dfe4ea;
    --text: #17202a;
    --muted: #6b7280;
    --primary: #1f2937;
    --sidebar: #111827;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}


html {
    scroll-behavior: smooth;
}


body {
    margin: 0;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans JP",
        "Hiragino Kaku Gothic ProN",
        "Yu Gothic",
        Meiryo,
        sans-serif;

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


button,
textarea {
    font: inherit;
}


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


/* =====================================================
   App
   ===================================================== */

.app-shell {
    min-height: 100vh;

    display: flex;
}



/* =====================================================
   Sidebar
   ===================================================== */

.sidebar {
    position: fixed;

    inset: 0 auto 0 0;

    width: 260px;

    padding: 28px 18px 20px;

    background: var(--sidebar);

    color: #e5e7eb;

    display: flex;
    flex-direction: column;

    z-index: 20;
}


.brand {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 0 10px 30px;
}


.brand-mark {
    width: 42px;
    height: 42px;

    border-radius: 12px;

    display: grid;
    place-items: center;

    background: #ffffff;

    color: #111827;

    font-size: 22px;
}


.brand strong,
.brand span {
    display: block;
}


.brand strong {
    font-size: 15px;
}


.brand span {
    margin-top: 3px;

    color: #9ca3af;

    font-size: 12px;
}


.nav {
    display: grid;

    gap: 6px;
}


.nav-admin-group {
    display: grid;

    gap: 6px;

    margin-top: 18px;

    padding-top: 16px;

    border-top: 1px solid #293241;
}


.nav-section-label {
    margin: 0 10px 2px;

    color: #9ca3af;

    font-size: 11px;

    font-weight: 700;

    letter-spacing: 0.08em;
}


.nav-item {
    padding: 12px 14px;

    border-radius: 9px;

    color: #cbd5e1;

    font-size: 14px;
}


.nav-item:hover,
.nav-item.active {
    background: #1f2937;

    color: #ffffff;
}


.sidebar-footer {
    margin-top: auto;

    padding: 16px 10px 4px;

    border-top: 1px solid #293241;
}


.access-badge {
    display: inline-block;

    padding: 4px 7px;

    border: 1px solid #4b5563;

    border-radius: 5px;

    color: #d1d5db;

    font-size: 9px;

    letter-spacing: 0.08em;
}


.sidebar-footer small {
    display: block;

    margin-top: 8px;

    color: #9ca3af;

    font-size: 10px;

    line-height: 1.6;
}



/* =====================================================
   Main
   ===================================================== */

.main {
    width: 100%;

    margin-left: 260px;

    min-width: 0;
}



/* =====================================================
   Topbar
   ===================================================== */

.topbar {
    min-height: 94px;

    padding: 18px 34px;

    background: var(--surface);

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

    display: flex;

    align-items: center;

    gap: 16px;
}


.menu-button {
    display: none;

    border: 1px solid var(--border);

    background: #ffffff;

    border-radius: 8px;

    width: 42px;
    height: 42px;

    cursor: pointer;
}


.eyebrow {
    margin: 0 0 5px;

    color: #7b8491;

    font-size: 10px;

    font-weight: 700;

    letter-spacing: 0.12em;
}


.topbar h1,
.page-intro h2,
.panel h3 {
    margin: 0;
}


.topbar h1 {
    font-size: 24px;
}


.topbar-actions {
    margin-left: auto;

    display: flex;

    align-items: center;

    gap: 10px;
}


.auth-status {
    color: var(--muted);

    font-size: 12px;
}


.auth-status.ok {
    color: #16803c;

    font-weight: 600;
}



/* =====================================================
   Buttons
   ===================================================== */

.primary-button,
.secondary-button {
    display: inline-block;

    box-sizing: border-box;

    text-align: center;

    text-decoration: none;

    border-radius: 8px;

    cursor: pointer;

    font-size: 13px;
}


.primary-button {
    border: 0;

    background: var(--primary);

    color: #ffffff;

    padding: 10px 17px;
}


.primary-button:hover {
    opacity: 0.92;
}


.secondary-button {
    border: 1px solid #cfd6df;

    background: #ffffff;

    color: #303945;

    padding: 9px 14px;
}


.secondary-button:hover {
    background: #f6f8fa;
}


.small-button {
    padding: 7px 11px;
}



/* =====================================================
   Content
   ===================================================== */

.content {
    max-width: 1400px;

    margin: 0 auto;

    padding: 34px;
}


.page-intro {
    margin-bottom: 22px;
}


.page-intro h2 {
    font-size: 20px;
}


.page-intro p:last-child {
    margin: 7px 0 0;

    color: var(--muted);

    font-size: 13px;
}


.message-area {
    margin-bottom: 14px;
}


.message {
    padding: 11px 13px;

    border-radius: 8px;

    font-size: 13px;

    background: #eef6ff;

    border: 1px solid #cfe2ff;
}


.message.error {
    background: #fff1f0;

    border-color: #f2c5c0;

    color: #9f2d24;
}



/* =====================================================
   Stats
   ===================================================== */

.stats {
    display: grid;

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

    gap: 14px;

    margin-bottom: 18px;
}


.stat-card,
.panel {
    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: 12px;

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


.stat-card {
    min-height: 126px;

    padding: 19px;
}


.stat-card span,
.stat-card small {
    display: block;
}


.stat-card span {
    color: var(--muted);

    font-size: 12px;
}


.stat-card strong {
    display: block;

    margin-top: 8px;

    font-size: 30px;

    line-height: 1;
}


.stat-card small {
    margin-top: 11px;

    color: #98a1ad;

    font-size: 10px;
}


.attention-card strong {
    color: #b45309;
}



/* =====================================================
   Dashboard Grid
   ===================================================== */

.dashboard-grid {
    display: grid;

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

    gap: 18px;
}


.panel {
    padding: 22px;
}


.panel-heading {
    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    gap: 15px;
}


.panel h3 {
    font-size: 17px;
}


.panel-description {
    color: var(--muted);

    font-size: 13px;

    line-height: 1.8;

    margin: 15px 0 18px;
}



/* =====================================================
   Quick Action
   ===================================================== */

.quick-action {
    display: flex;

    align-items: center;

    gap: 12px;

    width: 100%;

    padding: 12px;

    background: #f8fafc;

    border: 1px solid #e8edf2;

    border-radius: 9px;
}


.quick-action:hover {
    border-color: #cbd5e1;
}


.quick-icon {
    width: 36px;
    height: 36px;

    flex: 0 0 36px;

    border-radius: 9px;

    display: grid;

    place-items: center;

    background: #eef2f7;

    font-size: 17px;
}


.quick-action strong,
.quick-action small {
    display: block;
}


.quick-action strong {
    font-size: 13px;
}


.quick-action small {
    margin-top: 3px;

    color: var(--muted);

    font-size: 11px;
}



/* =====================================================
   Attention
   ===================================================== */

.attention-panel {
    margin-bottom: 18px;
}


.section-badge {
    display: inline-flex;

    padding: 5px 9px;

    border-radius: 999px;

    background: #eef2f7;

    color: #374151;

    font-size: 11px;

    font-weight: 700;

    white-space: nowrap;
}


.attention-list {
    display: grid;

    gap: 10px;
}


.empty-state {
    padding: 16px;

    border: 1px dashed #d5dce5;

    border-radius: 9px;

    background: #fafbfc;

    color: var(--muted);

    font-size: 13px;
}



/* =====================================================
   Memo
   ===================================================== */

.memo-panel {
    margin-top: 18px;
}


.memo-input {
    width: 100%;

    min-height: 130px;

    padding: 12px;

    resize: vertical;

    border: 1px solid #cfd6df;

    border-radius: 9px;

    background: #ffffff;

    color: var(--text);

    font-size: 13px;

    line-height: 1.7;

    outline: none;
}


.memo-input:focus {
    border-color: #9ca7b4;
}


.memo-actions {
    margin-top: 12px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;
}


.memo-actions > div {
    display: flex;

    gap: 8px;
}


.memo-status {
    color: var(--muted);

    font-size: 11px;
}



/* =====================================================
   Account
   ===================================================== */

.account-panel {
    margin-top: 18px;
}


.user-info {
    display: grid;

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

    gap: 12px;

    margin-top: 18px;
}


.user-info > div {
    padding: 13px;

    background: #f8fafc;

    border: 1px solid #e8edf2;

    border-radius: 9px;
}


.label {
    display: block;

    color: var(--muted);

    font-size: 10px;

    margin-bottom: 5px;
}


.user-info strong {
    font-size: 13px;

    overflow-wrap: anywhere;
}


.role-badge {
    display: inline-flex;

    padding: 5px 9px;

    border-radius: 999px;

    background: #eef2f7;

    color: #374151;

    font-size: 11px;

    font-weight: 700;
}


.role-badge.admin {
    background: #ede9fe;

    color: #6d28d9;
}


.role-badge.worker {
    background: #e0f2fe;

    color: #0369a1;
}



/* =====================================================
   Placeholder
   ===================================================== */

.placeholder-section {
    margin-top: 18px;

    scroll-margin-top: 20px;
}


.placeholder-section .panel {
    min-height: 150px;
}


.placeholder-section p:last-child {
    margin-bottom: 0;

    color: var(--muted);

    font-size: 13px;
}



/* =====================================================
   Utility
   ===================================================== */

[hidden] {
    display: none !important;
}



/* =====================================================
   Tablet
   ===================================================== */

@media (max-width: 1000px) {

    .sidebar {
        transform: translateX(-100%);

        transition:
            transform 0.2s;
    }


    .sidebar.open {
        transform: translateX(0);
    }


    .main {
        margin-left: 0;
    }


    .menu-button {
        display: block;
    }


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


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

}



/* =====================================================
   Mobile
   ===================================================== */

@media (max-width: 700px) {

    .topbar {
        padding: 15px 16px;
    }


    .topbar h1 {
        font-size: 20px;
    }


    .auth-status {
        display: none;
    }


    .content {
        padding: 22px 16px 34px;
    }


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


    .stats {
        gap: 9px;
    }


    .stat-card {
        min-height: 110px;

        padding: 15px;
    }


    .stat-card strong {
        font-size: 25px;
    }


    .user-info {
        grid-template-columns: 1fr;
    }


    .panel {
        padding: 18px;
    }


    .memo-actions {
        align-items: stretch;

        flex-direction: column;
    }


    .memo-actions > div {
        display: grid;

        grid-template-columns:
            1fr 1fr;
    }


    .primary-button,
    .secondary-button {
        min-height: 42px;
    }

}



/* =====================================================
   Small Mobile
   ===================================================== */

@media (max-width: 430px) {

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

}
