* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f5f7fa;
    color: #263238;
    font-family: Arial, "Microsoft JhengHei", sans-serif;
}

a {
    color: inherit;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 230px;
    height: 100vh;
    padding: 26px 18px;
    background: #17365d;
    color: white;
}

.brand {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 35px;
}

.sidebar a {
    display: block;
    margin: 5px 0;
    padding: 13px 14px;
    border-radius: 9px;
    text-decoration: none;
    color: #e5edf7;
}

.sidebar a:hover {
    background: #254d7b;
}

.main {
    margin-left: 230px;
}

.topbar {
    min-height: 66px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border-bottom: 1px solid #e5e9ef;
}

.topbar a {
    color: #17365d;
    text-decoration: none;
    font-weight: 700;
}

.content {
    padding: 30px;
}

h1 {
    margin: 0 0 6px;
}

.muted {
    color: #728197;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(190px,1fr));
    gap: 18px;
    margin-top: 25px;
}

.card {
    padding: 24px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 3px 15px rgba(0,0,0,.05);
    text-decoration: none;
}

.card span {
    display: block;
    color: #728197;
}

.card strong {
    display: block;
    margin-top: 12px;
    color: #17365d;
    font-size: 30px;
}

.panel {
    margin-top: 24px;
    padding: 24px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 3px 15px rgba(0,0,0,.05);
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.button,
button {
    border: 0;
    border-radius: 8px;
    padding: 11px 17px;
    cursor: pointer;
    font-size: 15px;
    text-decoration: none;
}

.primary {
    background: #17365d;
    color: white;
}

.secondary {
    background: #e8edf3;
    color: #263238;
}

.search {
    display: flex;
    gap: 10px;
    margin: 25px 0;
}

.search input {
    width: min(480px,100%);
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d9e0e8;
    border-radius: 8px;
    font: inherit;
    background: white;
}

.table-wrap {
    overflow-x: auto;
    background: white;
    border-radius: 13px;
    box-shadow: 0 3px 15px rgba(0,0,0,.05);
}

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

th,
td {
    padding: 14px 13px;
    text-align: left;
    border-bottom: 1px solid #edf0f4;
}

th {
    background: #f8fafc;
    color: #5c6b7c;
}

.code {
    color: #17365d;
    font-weight: 700;
}

.actions {
    display: flex;
    gap: 7px;
}

.actions form {
    margin: 0;
}

.small-button {
    border: 0;
    padding: 7px 10px;
    border-radius: 7px;
    background: #e8edf3;
    text-decoration: none;
    cursor: pointer;
}

.danger {
    background: #fff0f0;
    color: #b42318;
}

.empty {
    padding: 40px;
    text-align: center;
    color: #8492a6;
}

.form-card {
    margin-top: 25px;
    padding: 25px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 3px 15px rgba(0,0,0,.05);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 20px;
}

.form-grid label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}

.wide {
    grid-column: 1 / -1;
}

.form-actions {
    margin-top: 25px;
}

.flash {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.flash.success {
    background: #eaf8ef;
    color: #18763d;
}

.flash.error {
    background: #fff0f0;
    color: #b42318;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
}

.login-card {
    width: 410px;
    max-width: 100%;
    padding: 38px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 15px 45px rgba(0,0,0,.10);
}

.login-card h1 {
    text-align: center;
    color: #17365d;
}

.login-card > p {
    text-align: center;
    color: #8492a6;
    margin-bottom: 30px;
}

.login-card label {
    display: block;
    font-weight: 700;
    margin: 16px 0 7px;
}

.full {
    width: 100%;
    margin-top: 25px;
}

@media (max-width: 800px) {

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }

    .main {
        margin-left: 0;
    }

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

    .wide {
        grid-column: auto;
    }

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