* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 1rem 4rem;
    line-height: 1.5;
    color: #1a1a1a;
    background: #fafafa;
}

header {
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}
.user-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}
.user-bar form { margin: 0; }
h1 { font-size: 1.4rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.2rem; margin: 1rem 0; }
h3 { font-size: 1.0rem; margin: 1.5rem 0 0.5rem; }

nav a {
    color: #0066cc;
    text-decoration: none;
    margin-right: 1rem;
    font-size: 0.95rem;
}
nav a:hover { text-decoration: underline; }

form { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
form.inline-form { flex-direction: row; align-items: center; gap: 0.5rem; max-width: none; }
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; color: #444; }
label .muted { margin-top: 0.25rem; font-size: 0.8rem; }

input, textarea, button, select {
    font: inherit;
    padding: 0.55rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
}
input:focus, textarea:focus, select:focus { outline: 2px solid #0066cc; border-color: transparent; }
textarea { resize: vertical; min-height: 80px; font-family: inherit; }

button {
    background: #0066cc;
    color: white;
    border: 1px solid #0066cc;
    cursor: pointer;
    padding: 0.65rem 1.2rem;
    font-weight: 500;
}
button:hover { background: #0052a3; border-color: #0052a3; }
button:disabled { background: #bbb; border-color: #bbb; cursor: not-allowed; }
.btn-mini { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn-danger {
    background: #b00020;
    border-color: #b00020;
}
.btn-danger:hover { background: #8c001a; border-color: #8c001a; }
.btn-primary {
    display: inline-block;
    background: #0066cc;
    color: white;
    padding: 0.7rem 1.4rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
}
.btn-primary:hover { background: #0052a3; text-decoration: none; }

table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; background: white; border: 1px solid #e5e5e5; border-radius: 4px; overflow: hidden; }
th, td { padding: 0.55rem 0.75rem; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; vertical-align: top; }
th { background: #f7f7f7; font-weight: 500; color: #555; }
tr:last-child td { border-bottom: none; }
td a { color: #0066cc; text-decoration: none; }
td a:hover { text-decoration: underline; }
td select { padding: 0.3rem 0.5rem; font-size: 0.85rem; }
td .inline-form button { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

.muted { color: #888; font-size: 0.85rem; }
code { background: #f0f0f0; padding: 0.1rem 0.4rem; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 0.9em; }

.error { color: #b00020; background: #fce4e4; padding: 0.5rem 0.75rem; border-radius: 4px; border-left: 3px solid #b00020; }
.success { color: #006633; background: #e6f4ea; padding: 0.5rem 0.75rem; border-radius: 4px; border-left: 3px solid #006633; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    background: #eee;
    color: #555;
}
.badge-awaiting_customer { background: #fff3cd; color: #856404; }
.badge-awaiting_payment { background: #cce5ff; color: #004085; }
.badge-shipped { background: #d4edda; color: #155724; }
.badge-cancelled { background: #f8d7da; color: #721c24; }
.badge-warn { background: #f8d7da; color: #721c24; margin-left: 0.25rem; }

.suggestions {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 0.25rem;
}
.suggestions:empty { display: none; }
.sug { padding: 0.5rem 0.7rem; cursor: pointer; font-size: 0.9rem; border-bottom: 1px solid #f0f0f0; }
.sug:last-child { border-bottom: none; }
.sug:hover { background: #f0f7ff; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 1rem 0; }
dt { font-weight: 500; color: #666; font-size: 0.9rem; }
dd { margin: 0; font-size: 0.95rem; }

.order-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    border: 1px solid #e5e5e5;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}
.order-card .price { margin-left: auto; font-weight: 600; }

.copybox { display: flex; gap: 0.5rem; }
.copybox input { flex: 1; font-family: ui-monospace, monospace; font-size: 0.85rem; }

.thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
    display: block;
}

label.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
label.checkbox input { width: auto; }

.price-preview {
    padding: 0.4rem 0.7rem;
    background: #f7f7f7;
    border-radius: 4px;
    border-left: 3px solid #0066cc;
    font-size: 0.95rem;
}

.settings-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0 1rem;
}
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.3rem 0;
    gap: 1rem;
    font-size: 0.95rem;
}
.settings-row strong { text-align: right; }
.settings-uuid {
    margin: 0.5rem 0;
    border-top: 1px dashed #eee;
    padding-top: 0.5rem;
}
.settings-uuid summary { cursor: pointer; font-size: 0.8rem; padding: 0.2rem 0; }
.settings-uuid code {
    font-size: 0.75rem;
    color: #888;
    background: #f7f7f7;
    padding: 0.1rem 0.3rem;
    margin: 0.1rem 0;
    display: inline-block;
}

.csv-example {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
    font-family: ui-monospace, monospace;
    line-height: 1.5;
}

.pay-card {
    background: white;
    border: 2px solid #0066cc;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}
.pay-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.pay-row:last-child { border-bottom: none; }
.pay-row-big { padding: 0.75rem 0; }
.pay-row-big .pay-value strong { font-size: 1.3rem; color: #0066cc; }
.pay-label { color: #666; font-size: 0.85rem; }
.pay-value { display: flex; align-items: center; gap: 0.5rem; }
.pay-value code { font-size: 1.05rem; }

.tx-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}
.tx-card > div { padding: 0.15rem 0; }

.instructions {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    margin: 1rem 0;
}
.instructions summary {
    cursor: pointer;
    padding: 0.25rem 0;
    color: #0066cc;
    font-size: 0.9rem;
}
.instructions ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.instructions li { margin: 0.25rem 0; font-size: 0.9rem; }

.card-split {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 1.05rem;
}
.card-fixed {
    padding: 0.4rem 0.5rem;
    background: #f0f0f0;
    border-radius: 4px;
    letter-spacing: 0.05em;
    color: #555;
}
.card-mid {
    flex: 0 1 auto;
    width: 8ch;
    text-align: center;
    letter-spacing: 0.15em;
    font-family: inherit;
}
.card-preview {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.1em;
    font-size: 0.95rem;
    margin-top: 0.3rem;
}

.phone-input {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.phone-prefix {
    padding: 0.4rem 0.5rem;
    background: #f0f0f0;
    border-radius: 4px;
    color: #555;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.phone-digits {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.1em;
}

.status-waiting {
    background: #fff8e1;
    border-left: 3px solid #ffa000;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.status-cancelled {
    background: #fce4e4;
    border-left: 3px solid #b00020;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffa000;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 540px) {
    body { padding: 0.75rem; }
    dl { grid-template-columns: 1fr; gap: 0.1rem; }
    dt { margin-top: 0.5rem; }
    table { font-size: 0.85rem; }
    th, td { padding: 0.4rem; }
}
