/* 管理後台 */
body.admin {
  min-height: 100dvh;
  background:
    radial-gradient(70% 50% at 50% -10%, rgba(255, 184, 0, .12), transparent 70%),
    var(--hexbg), var(--ink);
}
.a-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + var(--safe-t)) 28px 14px;
  background: rgba(8, 9, 11, .78); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.a-top .brand-logo { font-size: 36px; }
.a-top-actions { display: flex; align-items: center; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em; background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.is-live { color: var(--ok); }
.badge.is-demo { color: var(--honey); }
.a-main { max-width: 1240px; margin: 0 auto; padding: 32px 28px 64px; }

.a-login { max-width: 400px; margin: 8vh auto 0; padding: 40px 32px 32px; border-radius: var(--r-lg); text-align: center; }
.a-login-logo { font-size: 64px; color: var(--honey); filter: drop-shadow(0 0 20px var(--honey-glow)); }
.a-login h1 { margin: 14px 0 6px; font-size: 24px; letter-spacing: .08em; }
.a-login p { margin: 0 0 22px; color: var(--text-2); font-size: 14px; }
.a-login form { display: grid; gap: 12px; }
.a-login input { height: 48px; padding: 0 16px; border-radius: 12px; outline: none; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1); font-size: 15px; text-align: center; letter-spacing: .12em; }
.a-login input:focus { border-color: var(--honey); box-shadow: 0 0 0 3px rgba(255, 184, 0, .12); }
.a-hint { margin: 16px 0 0 !important; font-size: 13px !important; }
code { font: 500 .92em var(--font-en); padding: 1px 6px; border-radius: 6px; background: rgba(255, 184, 0, .1); color: var(--honey-hi); }

.a-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.a-head h1 { margin: 0; font-size: 26px; letter-spacing: .06em; }
.a-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { position: relative; padding: 18px 20px; border-radius: var(--r-md); background: rgba(255, 255, 255, .03); border: 1px solid var(--line); overflow: hidden; }
.stat::after { content: ""; position: absolute; right: -14px; top: -14px; width: 64px; height: 72px; background: rgba(255, 184, 0, .06); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.stat span { display: block; font-size: 13px; color: var(--text-2); }
.stat b { display: block; margin: 4px 0 2px; font: 600 34px/1.1 var(--font-en); color: var(--honey-hi); }
.stat small { font-size: 12px; color: var(--muted); }

.a-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.a-tabs button { position: relative; padding: 12px 18px; font-size: 14.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.a-tabs button[aria-selected="true"] { color: var(--honey-hi); font-weight: 700; }
.a-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--honey); box-shadow: 0 0 10px var(--honey); }
.a-tabs i { font: 600 11px var(--font-en); font-style: normal; padding: 1px 7px; border-radius: 999px; background: var(--honey); color: #120D02; margin-left: 4px; }
.a-tabs i:empty { display: none; }

.a-grid { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 16px; align-items: start; }
.a-card { padding: 22px; border-radius: var(--r-lg); background: rgba(14, 15, 19, .78); border: 1px solid var(--line); min-width: 0; }
.a-card h2 { margin: 0 0 6px; font-size: 17px; }
.a-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.a-card-head h2 { margin: 0; }
.a-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.a-field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 0; padding: 0; border: 0; min-width: 0; }
.a-field span, .a-field legend { font-size: 12.5px; font-weight: 700; color: var(--text-2); padding: 0; }
.a-field input, .a-select {
  height: 42px; padding: 0 12px; border-radius: 10px; outline: none; min-width: 0;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1); font-size: 14.5px;
}
.a-field input:focus, .a-select:focus { border-color: var(--honey); }
.a-select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%23FFB800' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.a-select option { background: var(--ink-3); }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.8) sepia(1) saturate(4) hue-rotate(5deg); }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekdays label { position: relative; }
.weekdays input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.weekdays span { display: grid; place-items: center; height: 38px; border-radius: 10px; font-size: 14px; background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); transition: all .2s; }
.weekdays input:checked + span { background: var(--honey); color: #120D02; font-weight: 700; box-shadow: none; }
.weekdays input:focus-visible + span { outline: 2px solid var(--honey); outline-offset: 2px; }
.gen-preview { margin: 16px 0 14px; padding: 12px 14px; border-radius: 12px; font-size: 13px; color: var(--text-2); background: rgba(255, 184, 0, .07); border: 1px dashed var(--line-hi); }
.gen-preview b { color: var(--honey-hi); font: 600 18px var(--font-en); }

.slot-list { display: grid; gap: 14px; max-height: 640px; overflow-y: auto; padding-right: 4px; }
.day { border-radius: var(--r-md); background: rgba(255, 255, 255, .025); border: 1px solid rgba(255, 255, 255, .06); padding: 12px 14px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.day-head b { font-size: 14.5px; }
.day-head small { font-size: 12px; color: var(--muted); }
.day-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.slot { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .03); border-left: 3px solid var(--muted); }
.slot.s-open { border-left-color: var(--honey); }
.slot.s-booked { border-left-color: var(--ok); background: rgba(91, 212, 154, .06); }
.slot.s-closed { opacity: .55; }
.slot-time { font: 600 14px var(--font-en); }
.slot-who { flex: 1; min-width: 0; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
.slot .icon-btn svg { font-size: 16px; }
.slot .icon-btn.danger:hover { color: var(--err); box-shadow: inset 0 0 0 1px rgba(255, 122, 102, .5); background: rgba(255, 122, 102, .1); }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill.s-open { background: rgba(255, 184, 0, .14); color: var(--honey-hi); }
.pill.s-booked { background: rgba(91, 212, 154, .14); color: var(--ok); }
.pill.s-closed { background: rgba(255, 255, 255, .06); color: var(--muted); }
.a-empty { padding: 36px 12px; text-align: center; color: var(--muted); font-size: 14px; }

.a-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.a-toolbar .search { flex: 1 1 240px; margin: 0; }
.a-toolbar .search input { height: 42px; }
.table-wrap { overflow-x: auto; }
.a-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.a-table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.a-table td { padding: 14px 12px; border-bottom: 1px solid rgba(255, 255, 255, .05); vertical-align: top; }
.a-table tr:hover td { background: rgba(255, 184, 0, .03); }
.a-table .t-main { display: block; font-weight: 700; }
.a-table .t-sub { display: block; font-size: 12px; color: var(--muted); font-family: var(--font-en); }
.a-table .t-note { max-width: 240px; color: var(--text-2); font-size: 12.5px; }
.a-table a { color: var(--text); text-decoration: none; }
.a-table a:hover { color: var(--honey-hi); }
.status-sel { height: 34px; font-size: 13px; padding: 0 30px 0 10px; border-radius: 8px; font-weight: 700; }
.status-sel.st-confirmed { color: var(--honey-hi); }
.status-sel.st-done { color: var(--ok); }
.status-sel.st-cancelled { color: var(--muted); }
tr.is-cancelled td:not(:last-child) { opacity: .5; }

.kv { margin: 12px 0 0; display: grid; gap: 0; }
.kv div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.howto { margin: 12px 0; padding-left: 20px; display: grid; gap: 10px; font-size: 13.5px; color: var(--text-2); line-height: 1.75; }

@media (max-width: 960px) {
  .a-grid { grid-template-columns: 1fr; }
  .a-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .a-top { padding: calc(10px + var(--safe-t)) 16px 10px; }
  .a-top .brand-text small { display: none; }
  .a-main { padding: 20px 14px 48px; }
  .a-head h1 { font-size: 21px; }
  .stat { padding: 14px 16px; }
  .stat b { font-size: 28px; }
  .a-card { padding: 16px; }
  .a-login { padding: 32px 22px 26px; }
  .day-slots { grid-template-columns: 1fr; }
  /* 表格轉卡片 */
  .a-table thead { display: none; }
  .a-table, .a-table tbody, .a-table tr, .a-table td { display: block; width: 100%; }
  .a-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .a-table td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 84px 1fr; gap: 10px; }
  .a-table td::before { content: attr(data-label); font-size: 12px; color: var(--muted); padding-top: 2px; }
  .a-table .t-note { max-width: none; }
}
