* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f7f3f3;
    color: #231616;
    line-height: 1.6;
}

a {
    color: #7a1f2b;
}

.site-header {
    background: linear-gradient(90deg, #5b0f1b, #7a1f2b);
    color: #fff;
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 4px solid #c8a15a;
}

.site-title {
    font-size: 20px;
    font-weight: 700;
}

.site-version {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.login-user {
    font-size: 14px;
    margin-top: 8px;
}

.logout-link {
    color: #fff;
    margin-left: 12px;
    white-space: nowrap;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px;
}

.card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(91,15,27,0.12);
    border: 1px solid #eadddd;
}

.card .card {
    box-shadow: none;
    border: 1px solid #eadddd;
}

h1 {
    font-size: 22px;
    margin: 0 0 14px;
    color: #5b0f1b;
}

h2 {
    font-size: 18px;
    margin: 18px 0 10px;
    color: #6b1422;
}

h3 {
    font-size: 16px;
    margin: 16px 0 8px;
    color: #6b1422;
}

p {
    margin: 8px 0;
}

label {
    display: block;
    font-weight: 700;
    margin: 12px 0 6px;
    color: #3a2020;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="month"],
textarea,
select {
    width: 100%;
    font-size: 18px;
    padding: 12px;
    border: 1px solid #cbb8b8;
    border-radius: 10px;
    background: #fff;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="month"]:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(122,31,43,0.18);
    border-color: #7a1f2b;
}

input[type="checkbox"],
input[type="radio"] {
    transform: scale(1.25);
    margin-right: 8px;
}

textarea {
    min-height: 110px;
}

.btn,
button,
input[type="submit"] {
    display: inline-block;
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    background: linear-gradient(180deg, #8a2332, #5b0f1b);
    color: #fff;
    margin: 8px 0;
    min-height: 52px;
    box-shadow: 0 3px 8px rgba(91,15,27,0.22);
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
    filter: brightness(1.05);
}

.btn-secondary {
    background: #6b5b5f;
}

.btn-danger {
    background: #b91c1c;
}

.btn-small {
    font-size: 15px;
    padding: 9px 12px;
    min-height: auto;
    width: auto;
}

.menu-grid {
    display: grid;
    gap: 10px;
}

.menu-link {
    display: block;
    padding: 15px 16px;
    background: #fff;
    border: 1px solid #d8c5c5;
    border-left: 5px solid #7a1f2b;
    border-radius: 12px;
    text-decoration: none;
    color: #2b171b;
    font-weight: 700;
    min-height: 54px;
}

.menu-link:hover,
.menu-link:focus {
    background: #fbf4f4;
}

.flash {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 14px;
    background: #f1e7e7;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.flash-success {
    background: #e9f7ed;
    color: #166534;
}

.flash-info {
    background: #f5ead2;
    color: #7a4f00;
}

.site-footer {
    text-align: center;
    color: #6b5b5f;
    font-size: 12px;
    padding: 24px 12px;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 680px;
}

th,
td {
    padding: 10px;
    border: 1px solid #e3d4d4;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f5e9e9;
    color: #4b1019;
    white-space: nowrap;
}

.status-ok {
    color: #166534;
    font-weight: 700;
}

.status-ng {
    color: #991b1b;
    font-weight: 700;
}

.status-warn {
    color: #9a3412;
    font-weight: 700;
}

.summary-grid {
    display: grid;
    gap: 10px;
}

.summary-box {
    background: #fbf4f4;
    border: 1px solid #ead6d6;
    border-radius: 12px;
    padding: 12px;
    border-left: 5px solid #7a1f2b;
}

.summary-box-title {
    font-size: 13px;
    color: #7d676b;
}

.summary-box-value {
    font-size: 22px;
    font-weight: 700;
    color: #5b0f1b;
}

.form-row {
    display: grid;
    gap: 10px;
}

.stamp-row {
    border: 1px solid #ead6d6;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: #fbf4f4;
}

.mobile-note {
    font-size: 13px;
    color: #7d676b;
}

@media (min-width: 700px) {
    .container {
        padding: 20px;
    }

    .btn,
    button,
    input[type="submit"] {
        width: auto;
        min-width: 180px;
    }

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

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

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

@media (min-width: 1000px) {
    .menu-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 520px) {
    .site-header {
        padding: 12px;
    }

    .site-title {
        font-size: 18px;
    }

    .container {
        padding: 10px;
    }

    .card {
        padding: 14px;
        border-radius: 12px;
    }

    h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 17px;
    }

    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="month"],
    textarea,
    select {
        font-size: 16px;
        padding: 11px;
    }

    .btn,
    button,
    input[type="submit"] {
        font-size: 17px;
        min-height: 50px;
    }

    table {
        font-size: 14px;
    }

    th,
    td {
        padding: 8px;
    }
}

@media print {
    .site-header,
    .site-footer,
    .btn,
    button,
    form {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 0;
        padding: 0;
    }

    table {
        min-width: 0;
        font-size: 11px;
    }
}
