:root {
    color-scheme: light;
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    --accent: #0066cc;
}

html {
    overflow-y: scroll;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f5f7fb;
    color: #222;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 56px;
}

.dashboard-header {
    background: #fff;
    border-radius: 16px;
    padding: 3px 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dashboard-topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.dashboard-header__info,
.dashboard-topbar__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    color: #4c5968;
}

.dashboard-topbar__info {
    align-items: flex-end;
    text-align: right;
}

.dashboard-header__info strong,
.dashboard-topbar__info strong {
    font-size: 16px;
    color: #222;
}

.dashboard-topbar__actions {
    justify-content: flex-end;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.dashboard-actions__link {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.1;
    transition: background 0.2s;
}

.dashboard-actions__link:hover {
    background: #004c99;
}

h1 {
    font-size: 20px;
    margin-bottom: 12px;
}

h2 {
    font-size: 18px;
    margin: 16px 0 12px;
}

.lead {
    font-size: 14px;
    color: #4c5968;
    margin: 0 0 24px;
}

form {
    background: #fff;
    border-radius: 16px;
    padding: 20px 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.field-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

.field-grid--stack {
    grid-template-columns: 1fr;
}

.field-grid--stack > div {
    min-width: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    align-items: center;
    gap: 8px;
}

.field-grid--stack label {
    margin-bottom: 0;
    white-space: nowrap;
}

.field-grid--stack select,
.field-grid--stack input[type="date"],
.field-grid--stack textarea {
    width: 100%;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

select,
input[type="date"],
input[type="number"],
textarea {
    width: 100%;
    border: 1px solid #cfd5de;
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 15px;
    background: #fff;
}

textarea {
    resize: vertical;
    min-height: 72px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.price-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
}

.price-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #f0f5ff;
    border: 1px solid rgba(0, 102, 204, 0.12);
    border-radius: 12px;
    padding: 6px 8px;
}

.price-card span {
    font-size: 15px;
    color: #22313f;
}

.price-card input {
    width: 120px;
    max-width: 45%;
    flex-shrink: 0;
    text-align: right;
    cursor: pointer;
    border: 1px solid #dfe6f2;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    font-weight: 600;
    color: #22313f;
    font-variant-numeric: tabular-nums;
}

.totals {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
    margin-top: 20px;
    padding: 16px;
    background: #fff7e6;
    border: 1px solid rgba(255, 153, 0, 0.2);
    border-radius: 12px;
    font-size: 15px;
    color: #6b3f00;
    font-weight: 600;
}

.totals strong {
    font-size: 18px;
    color: #b26b00;
    font-weight: 700;
}

.totals__label {
    margin-right: 4px;
}

.totals__capsule,
.totals__sales {
    white-space: nowrap;
}

.quantity-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(2px);
    z-index: 1000;
}

.quantity-modal__dialog {
    position: relative;
    width: min(340px, 100%);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
    display: flex;
    flex-direction: column;
    padding: 24px 24px 20px;
    gap: 20px;
}

.quantity-modal__header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 600;
    color: #0f172a;
    padding-right: 32px;
}

.quantity-modal__label {
    font-size: 18px;
    font-weight: 700;
    color: #1f2933;
    white-space: nowrap;
}

.quantity-modal__subtitle {
    font-size: 13px;
    color: #64748b;
    letter-spacing: 0.02em;
}

.quantity-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.quantity-modal__close:hover,
.quantity-modal__close:focus-visible {
    background: rgba(100, 116, 139, 0.12);
    color: #0f172a;
    outline: none;
}

.quantity-modal__display {
    min-height: 52px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 16px;
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
}

.quantity-modal__display--empty::after {
    content: "数字を入力してください";
    font-size: 16px;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0;
}

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

.quantity-modal__key {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 0;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    background: #f8fafc;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}

.quantity-modal__key:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.1);
    background: #eef2f6;
}

.quantity-modal__key--back {
    grid-column: 1;
    font-size: 16px;
}

.quantity-modal__key--zero {
    grid-column: 2;
    font-size: 18px;
}

.quantity-modal__key--clear {
    grid-column: 3;
    font-size: 15px;
    letter-spacing: 0.05em;
}

.quantity-modal__actions {
    display: flex;
    gap: 12px;
}

.quantity-modal__cancel,
.quantity-modal__confirm {
    flex: 1;
    padding: 13px 12px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: transform 0.1s, box-shadow 0.1s;
}

.quantity-modal__cancel {
    background: #ecf1f8;
    color: #334155;
}

.quantity-modal__confirm {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 102, 204, 0.28);
}

.quantity-modal__cancel:active,
.quantity-modal__confirm:active {
    transform: translateY(1px);
    box-shadow: none;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

button {
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

button:hover {
    background: #004c99;
}

button:disabled {
    background: #90a4bd;
    cursor: not-allowed;
}

.button-secondary {
    background: #6b7280;
}

.button-secondary:hover {
    background: #4b5563;
}

.message {
    font-size: 13px;
    color: #006644;
    text-align: center;
    display: none;
}

.table-container {
    margin-top: 16px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

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

table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: #e9f1ff;
}

th,
td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eef2f7;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: none;
}

.align-right {
    text-align: right;
}

.comment-cell {
    min-width: 220px;
    white-space: pre-wrap;
    word-break: break-word;
}

.table-action-cell {
    text-align: center;
}

.table-action-button {
    width: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.table-action-button:hover {
    background: transparent;
    color: #004c99;
    text-decoration: underline;
}

.table-action-button:disabled {
    background: transparent;
    color: #94a3b8;
    cursor: not-allowed;
    text-decoration: none;
}

.empty-state {
    padding: 24px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

@media (min-width: 600px) {
    h1 {
        font-size: 24px;
    }

    .lead {
        font-size: 15px;
    }

    form {
        padding: 24px 28px;
    }

    .field-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .field-grid--stack {
        grid-template-columns: 1fr;
    }

    .price-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .totals {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .actions {
        flex-direction: row;
        align-items: center;
    }

    button {
        width: auto;
        padding: 12px 24px;
    }

    .message {
        text-align: left;
    }

    .dashboard-topbar {
        gap: 16px;
    }
}

@media (min-width: 960px) {
    .container {
        max-width: 960px;
        padding: 40px 24px 64px;
    }
}
