:root {
  --ink: #211a29;
  --ink-2: #423a4d;
  --paper: #e6e3e9;
  --panel: #fff;
  --muted: #6e6875;
  --line: #e5e0e7;
  --accent: #cf0070;
  --accent-dark: #a30059;
  --accent-soft: #fce4f1;
  --warning: #d97706;
  --ok: #14844c;
  --shadow: 0 2px 5px rgba(33,26,41,.06), 0 15px 38px rgba(33,26,41,.1);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(800px 300px at 85% -70px, rgba(207,0,112,.08), transparent 65%), var(--paper); font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 1000; height: 64px; min-height: 64px; padding: 6px 20px; display: flex; align-items: center; gap: 18px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(33,26,41,.07), 0 6px 18px rgba(33,26,41,.08); backdrop-filter: blur(10px); }
.topbar::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg,var(--accent) 0%,var(--accent) 34%,rgba(207,0,112,.12) 100%); pointer-events: none; }
.topbar-logo { width: auto; height: 50px; object-fit: contain; display: block; flex-shrink: 0; }
.topbar-brand { color: var(--ink); font-size: 17px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }
.header-home-link { padding: 7px 13px; border: 1px solid #d8d4de; border-radius: 999px; background: #fff; color: var(--ink-2); font-size: 12px; font-weight: 700; text-decoration: none; }
.header-home-link:hover { border-color: var(--accent); background: var(--accent); color: #fff; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; justify-content: flex-end; }

.shell { width: min(1180px, 100%); margin: 0 auto; padding: 24px 16px 70px; }
.state-view { min-height: 60vh; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; }
.state-view p { max-width: 420px; margin: 0 0 12px; color: var(--muted); line-height: 1.7; }
.state-view h1 { margin: 0; }
.state-kicker, .eyebrow { color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .2em; }
.loading-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(135deg,#e8148a,var(--accent-dark)); color: #fff; font-size: 25px; font-weight: 900; box-shadow: 0 8px 25px rgba(207,0,112,.3); animation: breathe 1.3s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.94); opacity: .75; } }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-heading h1 { margin: 7px 0 6px; font-size: clamp(27px, 4vw, 36px); }
.page-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.icon-button, .back-button { border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.icon-button { width: 42px; height: 42px; border-radius: 12px; font-size: 22px; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.summary-card { min-height: 102px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); box-shadow: 0 2px 12px rgba(33,26,41,.05); cursor: pointer; text-align: left; }
.summary-card strong { display: block; margin-top: 7px; font-size: 28px; }
.summary-card span { color: var(--muted); font-size: 12px; font-weight: 700; }
.summary-card.accent { border-color: rgba(207,0,112,.28); background: linear-gradient(145deg,#fff,#fff5fa); }
.summary-card.accent strong { color: var(--accent); }

.workbench { border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.78); box-shadow: var(--shadow); overflow: hidden; }
.toolbar { padding: 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); background: #fff; }
.filter-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-button { padding: 9px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; cursor: pointer; }
.filter-button.active { background: var(--accent-soft); color: var(--accent-dark); }
.search-box { min-width: 265px; display: flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: #faf9fb; }
.search-box input { width: 100%; height: 38px; border: 0; outline: 0; background: transparent; font-size: 13px; }

.ticket-list { padding: 11px; display: grid; gap: 8px; }
.ticket-card { position: relative; width: 100%; padding: 15px 16px; display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) auto; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: inherit; text-align: left; cursor: pointer; }
.ticket-card:hover { border-color: rgba(207,0,112,.36); transform: translateY(-1px); }
.ticket-number { display: block; color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.ticket-card h3 { margin: 5px 0 4px; font-size: 16px; }
.ticket-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-contact strong, .ticket-contact span { display: block; }
.ticket-contact strong { font-size: 13px; }
.ticket-contact span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.ticket-side { display: grid; justify-items: end; gap: 8px; }
.ticket-time { color: var(--muted); font-size: 10px; }
.status-pill { display: inline-flex; padding: 5px 9px; border-radius: 99px; background: #efedf1; color: var(--ink-2); font-size: 10px; font-weight: 900; white-space: nowrap; }
.status-pending { background: var(--accent-soft); color: var(--accent-dark); }
.status-follow_up { background: #fff1d8; color: #9a5800; }
.status-processing { background: #e4f0ff; color: #1261a6; }
.status-completed, .status-closed { background: #e2f5e9; color: var(--ok); }
.empty-list { padding: 58px 20px; color: var(--muted); text-align: center; }

.detail-panel { position: fixed; inset: 0; z-index: 100; }
.detail-backdrop { position: absolute; inset: 0; background: rgba(25,20,29,.52); backdrop-filter: blur(3px); }
.detail-sheet { position: absolute; top: 0; right: 0; width: min(620px,100%); height: 100%; display: flex; flex-direction: column; background: var(--paper); box-shadow: -20px 0 60px rgba(20,12,24,.24); }
.detail-header { min-height: 77px; padding: 13px 18px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; border-top: 3px solid var(--accent); border-bottom: 1px solid var(--line); background: #fff; }
.back-button { width: 40px; height: 40px; border-radius: 12px; font-size: 31px; line-height: 1; }
.detail-number { color: var(--accent); font-size: 10px; font-weight: 900; }
.detail-header h2 { margin: 3px 0 0; font-size: 17px; }
.detail-content { padding: 14px 14px max(30px,env(safe-area-inset-bottom)); overflow-y: auto; }
.detail-card { margin-bottom: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.detail-card h3 { margin: 0 0 13px; font-size: 13px; }
.info-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.info-field span, .field-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 800; }
.info-field strong { font-size: 13px; overflow-wrap: anywhere; }
.issue-text { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.75; white-space: pre-wrap; }
.photo-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #eee; cursor: zoom-in; }
.call-button, .primary-button { display: flex; align-items: center; justify-content: center; min-height: 46px; border: 0; border-radius: 11px; background: linear-gradient(135deg,#e21483,var(--accent)); color: #fff; font-weight: 850; text-decoration: none; box-shadow: 0 7px 18px rgba(207,0,112,.25); cursor: pointer; }
.call-button { margin-top: 13px; }
.action-row { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.secondary-button { min-height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-2); font-weight: 750; cursor: pointer; }
.secondary-button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.form-stack { display: grid; gap: 10px; }
.form-stack textarea, .form-stack input { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #faf9fb; outline: 0; }
.form-stack textarea { min-height: 88px; padding: 11px; resize: vertical; }
.form-stack input { height: 42px; padding: 0 11px; }
.form-stack textarea:focus, .form-stack input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(207,0,112,.1); }
.log-list { display: grid; gap: 9px; }
.log-item { padding-left: 12px; border-left: 3px solid var(--line); }
.log-item strong { display: block; font-size: 12px; }
.log-item p { margin: 4px 0; color: var(--ink-2); font-size: 12px; line-height: 1.55; }
.log-item time { color: var(--muted); font-size: 10px; }
.toast { position: fixed; z-index: 200; left: 50%; bottom: max(26px,env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 15px; border-radius: 10px; background: #2b2430; color: #fff; box-shadow: var(--shadow); font-size: 12px; }

@media (max-width: 760px) {
  .shell { padding: 20px 12px 72px; }
  .page-heading { align-items: center; }
  .page-heading p { max-width: 270px; }
  .summary-grid { grid-template-columns: repeat(2,1fr); }
  .summary-card { min-height: 88px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-box { min-width: 0; }
  .ticket-card { grid-template-columns: 1fr auto; gap: 10px; }
  .ticket-contact { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding-top: 9px; border-top: 1px solid var(--line); }
  .ticket-contact span { margin: 0; }
  .ticket-side { grid-column: 2; grid-row: 1; }
}

@media (max-width: 420px) {
  .topbar { gap: 8px; padding: 6px 12px; }
  .topbar-logo { height: 42px; max-width: 88px; }
  .topbar-brand { font-size: 14px; }
  .header-home-link { padding: 6px 9px; }
  .page-heading p { display: none; }
  .info-grid { grid-template-columns: 1fr; }
}
