:root {
    --navy: #1b2a4a;
    --navy-dark: #10192e;
    --gold: #c9a227;
    --red: #b0202e;
    --grey: #f5f5f7;
    --border: #ddd;
    --text: #222;
    --success-bg: #e6f6e9;
    --success-border: #2e8b4f;
    --error-bg: #fdecec;
    --error-border: #b0202e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--grey);
    color: var(--text);
    line-height: 1.5;
}

.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 16px;
}

.site-header {
    text-align: center;
    padding: 24px 16px;
    background: var(--navy);
    color: #fff;
    border-radius: 10px;
    margin-bottom: 20px;
}

.site-header h1 {
    margin: 0 0 4px;
    font-size: 1.6rem;
}

.site-header .subtitle {
    margin: 0;
    color: var(--gold);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 18px;
}

.card h2 {
    margin-top: 0;
    font-size: 1.15rem;
    color: var(--navy);
    border-bottom: 2px solid var(--grey);
    padding-bottom: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.form-field label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #444;
}

input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
select, textarea {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
    font-family: inherit;
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--navy);
    outline-offset: 1px;
}

.item-row {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    background: #fafafa;
}

.item-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.item-row-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--navy);
}

.item-line-total {
    text-align: right;
    font-weight: 600;
    margin-top: 4px;
    color: var(--navy);
}

/* ---- Design picker (visual design selection with preview images) ---- */
.design-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 2px;
}

.design-option {
    cursor: pointer;
}

.design-option input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.design-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 96px;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: #fff;
    text-align: center;
    transition: border-color .12s ease, background .12s ease;
}

.design-card img,
.design-card .design-placeholder {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.design-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

.design-option input:checked + .design-card {
    border-color: var(--navy);
    background: #eef1f8;
    box-shadow: 0 0 0 1px var(--navy) inset;
}

.design-option input:focus-visible + .design-card {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

.fee-note {
    font-size: 0.82rem;
    color: #666;
    margin: 0 0 8px;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: 6px;
    padding: 11px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--red);
    color: #fff;
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
}

.btn-primary:hover { background: #8f1a25; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }

.btn-secondary {
    background: var(--navy);
    color: #fff;
}

.btn-secondary:hover { background: var(--navy-dark); }

.btn-remove {
    background: transparent;
    border: 1px solid var(--error-border);
    color: var(--error-border);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-remove:hover { background: var(--error-bg); }

.total-card {
    text-align: center;
}

.grand-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 16px;
    padding: 0 4px;
}

.alert {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: #205c34;
}

.alert-error {
    background: var(--error-bg);
    border-color: var(--error-border);
    color: #7a1622;
}

.alert ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
}

.site-footer {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    padding: 20px 0;
}

/* ---- Admin ---- */
.admin-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--navy);
    color: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-nav a {
    color: #fff;
    text-decoration: none;
    margin-right: 16px;
    font-weight: 600;
}

.admin-nav a:hover { color: var(--gold); }

.admin-nav .nav-links { display: flex; flex-wrap: wrap; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

table.data-table th, table.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.92rem;
}

table.data-table th {
    background: var(--grey);
    color: var(--navy);
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-new { background: #fde8cc; color: #8a5a00; }
.badge-processing { background: #d6e8fb; color: #14508a; }
.badge-completed { background: var(--success-bg); color: #205c34; }
.badge-cancelled { background: var(--error-bg); color: #7a1622; }

.login-box {
    max-width: 380px;
    margin: 60px auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px;
}

.design-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.table-wrap { overflow-x: auto; }

@media (max-width: 600px) {
    .site-header h1 { font-size: 1.3rem; }
    .grand-total { font-size: 1.1rem; }
}
