﻿:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #1f2933;
    --muted: #6b7280;
    --line: #d9dee7;
    --primary: #06c755;
    --primary-dark: #05a849;
    --danger: #e5484d;
    --soft: #edf7f1;
    --shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    width: min(100%, 760px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.page-header {
    padding: 20px 0 18px;
}

.page-header.slim {
    padding: 14px 0 12px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: 30px;
    line-height: 1.16;
}

h2 {
    margin-bottom: 14px;
    font-size: 20px;
}

h3 {
    margin-bottom: 3px;
    font-size: 17px;
}

.subtext,
.client-card p,
.customer-main p {
    color: var(--muted);
}

.panel,
.client-card,
.customer-card,
.empty-state {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 18px;
}

.section-block {
    margin-top: 24px;
}

.section-title-row,
.top-nav,
.calendar-toolbar,
.action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.top-nav {
    min-height: 42px;
}

.stack-form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    color: #374151;
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 11px 12px;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.14);
}

.two-column {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.primary-button,
.outline-button,
.danger-button,
.small-link,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 0 14px;
    font-weight: 700;
    cursor: pointer;
}

.primary-button {
    background: var(--primary);
    color: #fff;
}

.primary-button.compact {
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
}

.outline-button,
.small-link {
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}

.danger-button {
    background: #fff;
    border-color: #f2b8bb;
    color: var(--danger);
}

.danger-button.full-width {
    width: 100%;
}

.danger-zone {
    margin-top: 18px;
    padding-bottom: 8px;
}

.icon-button {
    width: 42px;
    padding: 0;
    background: #fff;
    border-color: var(--line);
    font-size: 26px;
    line-height: 1;
}

.client-list,
.customer-list {
    display: grid;
    gap: 12px;
}

.client-card,
.customer-card {
    padding: 14px;
}

.client-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.empty-state {
    padding: 18px;
    color: var(--muted);
    text-align: center;
}

.calendar-toolbar {
    margin: 6px 0 12px;
}

.calendar-toolbar h2 {
    margin: 0;
    font-size: 19px;
}

.calendar-wrap {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    border-bottom: 1px solid var(--line);
    background: #fbfcfd;
}

.calendar-weekdays span {
    padding: 10px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.calendar-day {
    position: relative;
    min-height: 78px;
    border: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff;
    padding: 8px 6px;
    text-align: left;
    cursor: pointer;
}

.calendar-day:nth-child(7n) {
    border-right: 0;
}

.calendar-day.other-month {
    background: #f7f8fa;
    color: #a0a7b1;
}

.calendar-day.selected {
    background: var(--soft);
    box-shadow: inset 0 0 0 2px var(--primary);
}

.day-number {
    display: block;
    font-size: 13px;
    font-weight: 800;
}

.event-pill {
    display: flex;
    align-items: center;
    width: 100%;
    margin-top: 5px;
    overflow: hidden;
    border-radius: 5px;
    background: #eef2f7;
    color: #25313f;
    padding: 2px 5px;
    font-size: 12px;
    white-space: nowrap;
    text-decoration: none;
}

.event-pill.leather {
    background: #FFE4CC;
    color: #D2691E;
}

.event-pill.dye {
    background: #D6ECFF;
    color: #1E6FD9;
}

.event-pill-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-dot {
    display: inline-block;
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-pending {
    background: #9CA3AF;
}

.status-progress {
    background: #FACC15;
}

.status-done {
    background: #22C55E;
}

.last-edited {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.more-count {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.customer-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.customer-main h2 {
    margin-bottom: 4px;
    font-size: 18px;
}

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

.info-grid div {
    min-width: 0;
    border-radius: 8px;
    background: #f7f8fa;
    padding: 9px;
}

.info-grid dt {
    color: var(--muted);
    font-size: 12px;
}

.info-grid dd {
    margin: 2px 0 0;
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.compact-list .customer-card {
    box-shadow: none;
}

@media (min-width: 620px) {
    .app-shell {
        padding-top: 32px;
    }

    h1 {
        font-size: 36px;
    }

    .two-column {
        grid-template-columns: 1fr 1fr;
    }

    .calendar-day {
        min-height: 104px;
        padding: 10px;
    }
}

.liff-shell {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(40px, env(safe-area-inset-bottom));
}

.single-action {
    justify-content: flex-end;
}

.flash-list {
    display: grid;
    gap: 10px;
    margin: 10px 0 16px;
}

.flash-message {
    border: 1px solid #a7e4bd;
    border-radius: 8px;
    background: #edfff3;
    color: #146c2e;
    padding: 12px 14px;
    font-weight: 800;
}

.order-code {
    margin: 8px 0 10px;
    color: #111827;
    font-size: 14px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.derived-status-box,
.customer-status-summary {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f8fa;
    padding: 12px;
}

.derived-status-box span,
.customer-status-summary span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.derived-status-box strong,
.customer-status-summary strong {
    display: block;
    margin-top: 2px;
    color: var(--text);
    font-size: 22px;
    line-height: 1.2;
}

.customer-status-summary {
    margin: 10px 0 12px;
}

.customer-status-summary span {
    margin-top: 4px;
    font-size: 15px;
}

.customer-info-grid {
    grid-template-columns: 1fr;
}

.customer-info-grid div {
    padding: 11px;
}

@media (min-width: 480px) {
    .customer-info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.compact-heading {
    margin-top: 16px;
    margin-bottom: 10px;
    font-size: 16px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

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

.image-card {
    display: block;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 0;
    cursor: zoom-in;
}

.image-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.86);
    padding: 18px;
}

.image-preview-overlay.active {
    display: flex;
}

.image-preview-overlay img {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 8px;
    background: #fff;
}

.image-preview-close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.nav-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 8px;
    box-shadow: var(--shadow);
}

.nav-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #374151;
    font-weight: 800;
    text-align: center;
}

.nav-tab.active {
    background: var(--primary);
    color: #fff;
}

.order-detail-card {
    display: grid;
    gap: 16px;
}

.order-detail-header {
    display: grid;
    gap: 12px;
}

.order-detail-header h2 {
    margin: 0;
    font-size: 24px;
    overflow-wrap: anywhere;
}

.order-status-badge {
    border: 1px solid #a7e4bd;
    border-radius: 8px;
    background: #edfff3;
    padding: 12px;
}

.order-status-badge strong {
    display: block;
    color: #146c2e;
    font-size: 24px;
    line-height: 1.15;
}

.order-status-badge span {
    display: block;
    margin-top: 4px;
    color: #247a3d;
    font-size: 15px;
    font-weight: 800;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
}

.detail-grid div {
    min-width: 0;
    border-radius: 8px;
    background: #f7f8fa;
    padding: 11px;
}

.detail-grid dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.detail-grid dd {
    margin: 3px 0 0;
    font-size: 15px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.order-images-section {
    display: grid;
    gap: 10px;
}

.order-image-grid {
    margin-top: 0;
}

.public-footer-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 22px;
}

.notice-panel {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.notice-panel h2 {
    margin-bottom: 0;
}

.notice-panel p {
    margin-bottom: 0;
    color: var(--muted);
}

.compact-empty {
    box-shadow: none;
    padding: 14px;
}

@media (min-width: 560px) {
    .order-detail-header {
        grid-template-columns: 1fr auto;
        align-items: start;
    }

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

    .detail-full {
        grid-column: 1 / -1;
    }

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

@media (min-width: 760px) {
    .order-image-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
