:root {
  color-scheme: light;
  --paper: #fcf7f0;
  --surface: #fffdf9;
  --ink: #30231c;
  --ink-deep: #17231e;
  --muted: #786f69;
  --orange: #d95700;
  --orange-dark: #aa4300;
  --orange-soft: #ffe9d8;
  --green: #1f674f;
  --green-soft: #e1eee7;
  --amber: #e9a436;
  --line: #ede1d7;
  --danger: #b7372d;
  --shadow: 0 24px 70px rgba(66, 39, 21, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button, select, input[type="radio"], input[type="checkbox"] { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 10px 14px; color: white; background: var(--ink); transform: translateY(-180%); }
.skip-link:focus { transform: none; }

.topbar { width: min(1240px, calc(100% - 48px)); min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-inline: auto; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 900; letter-spacing: -.03em; text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 13px; box-shadow: 0 8px 20px rgba(217,87,0,.2); }
.brand.inverse { color: white; }
.brand small { display: block; color: #a9b9b1; font-size: .66rem; font-weight: 700; letter-spacing: .06em; }
.secure-note { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.secure-note i { width: 8px; height: 8px; border-radius: 50%; background: #38a169; box-shadow: 0 0 0 5px rgba(56,161,105,.12); }

.page-shell { width: min(1240px, calc(100% - 48px)); display: grid; grid-template-columns: .82fr 1.18fr; gap: 64px; align-items: start; margin: 35px auto 80px; }
.intro { position: sticky; top: 32px; padding: 54px 16px 20px 0; }
.eyebrow, .step-label { margin: 0 0 18px; color: var(--orange); font-size: .74rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.intro h1 { max-width: 570px; margin: 0 0 25px; font-size: clamp(3.5rem, 6.4vw, 6.4rem); font-weight: 860; line-height: .94; letter-spacing: -.07em; }
.intro h1 em { color: var(--orange); font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
.intro-copy { max-width: 570px; margin: 0; color: #5f554f; font-size: 1.12rem; }
.promise-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 42px 0; border: 1px solid var(--line); border-radius: 18px; background: var(--line); overflow: hidden; }
.promise-grid article { padding: 18px 15px; background: rgba(255,255,255,.62); }
.promise-grid span { display: block; margin-bottom: 16px; color: var(--orange); font-size: .65rem; font-weight: 900; letter-spacing: .1em; }
.promise-grid strong, .promise-grid small { display: block; }
.promise-grid strong { font-size: .88rem; }
.promise-grid small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
blockquote { display: flex; gap: 14px; margin: 0; padding: 22px 24px; border-left: 3px solid var(--amber); color: #4f473f; background: #fff4d8; font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; font-style: italic; }
blockquote span { color: var(--orange); font-size: 2.5rem; line-height: .75; }

.form-card { overflow: hidden; border: 1px solid var(--line); border-radius: 32px; background: var(--surface); box-shadow: var(--shadow); }
#feedback-form { padding: clamp(28px, 5vw, 56px); }
.account-link-status { display: grid; gap: 3px; margin: 0 0 24px; padding: 13px 15px; border: 1px solid #b9ddc9; border-radius: 14px; color: #175b3d; background: #edf8f1; font-size: .82rem; }
.account-link-status span { color: #4c695b; font-size: .74rem; }
.form-heading { padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.form-heading h2 { margin: 0 0 8px; font-size: clamp(2rem, 3.4vw, 3.2rem); line-height: 1; letter-spacing: -.05em; }
.form-heading > p:last-child { margin: 0; color: var(--muted); font-size: .88rem; }
.form-heading b, legend b, .field > span b { color: var(--orange); }

fieldset { padding: 0; margin: 34px 0; border: 0; }
legend, .field > span, .field-title > span, .composer label > span { margin-bottom: 11px; font-size: .86rem; font-weight: 850; }
.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.category-grid label { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; min-height: 79px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 16px; background: white; transition: border-color 160ms, background 160ms, transform 160ms; }
.category-grid label:hover { border-color: #dbbca7; transform: translateY(-1px); }
.category-grid label:has(input:checked) { border-color: var(--orange); background: var(--orange-soft); box-shadow: inset 0 0 0 1px var(--orange); }
.category-grid input { position: absolute; opacity: 0; }
.category-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; color: var(--orange-dark); background: var(--orange-soft); font-family: Georgia, serif; font-size: 1.1rem; font-weight: 900; }
.category-grid label:has(input:checked) .category-icon { color: white; background: var(--orange); }
.category-grid strong, .category-grid small { display: block; }
.category-grid strong { font-size: .9rem; }
.category-grid small { margin-top: 2px; color: var(--muted); font-size: .69rem; }

.field { position: relative; display: grid; margin: 25px 0; }
.field > span { display: block; }
.field > span i { color: var(--muted); font-size: .75rem; font-style: normal; font-weight: 600; }
.field input, .field textarea, .composer textarea, .filters select, .status-control select { width: 100%; border: 1px solid #decfc4; border-radius: 14px; outline: 0; color: var(--ink); background: #fff; transition: border-color 160ms, box-shadow 160ms; }
.field input { min-height: 54px; padding: 0 16px; }
.field textarea, .composer textarea { padding: 15px 16px; resize: vertical; }
.field input:focus, .field textarea:focus, .composer textarea:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(217,87,0,.1); }
.field > small { margin-top: 7px; color: var(--muted); font-size: .7rem; }
.field > small:has(output) { position: absolute; right: 12px; bottom: 9px; padding-left: 10px; background: white; }
.field textarea + small { bottom: 10px; }

.field-title { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; margin-bottom: 11px; }
.field-title small { color: var(--muted); font-size: .68rem; }
.dropzone { min-height: 150px; display: grid; place-items: center; align-content: center; padding: 24px; border: 1.5px dashed #d0b7a6; border-radius: 18px; background: #fffaf5; text-align: center; transition: border-color 160ms, background 160ms; }
.dropzone.dragging { border-color: var(--orange); background: var(--orange-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-mark { display: grid; width: 42px; height: 42px; place-items: center; margin-bottom: 9px; border-radius: 50%; color: white; background: var(--orange); font-size: 1.5rem; }
.dropzone strong { font-size: .9rem; }
.dropzone small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.preview-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin-top: 12px; }
.preview-item { position: relative; overflow: hidden; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 13px; background: var(--orange-soft); }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item button { position: absolute; top: 5px; right: 5px; width: 25px; height: 25px; padding: 0; border: 0; border-radius: 50%; color: white; background: rgba(23,35,30,.78); }
.preview-item span { position: absolute; right: 5px; bottom: 4px; left: 5px; overflow: hidden; padding: 2px 5px; border-radius: 5px; color: white; background: rgba(23,35,30,.72); font-size: .55rem; text-overflow: ellipsis; white-space: nowrap; }

.consent { display: grid; grid-template-columns: 19px 1fr; gap: 11px; align-items: start; margin: 28px 0; color: #5f554f; font-size: .78rem; }
.consent input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--orange); }
.honeypot { position: absolute; left: -10000px; }
.turnstile-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 24px 0; }
.turnstile-wrap p { max-width: 210px; margin: 0; color: var(--muted); font-size: .65rem; }
.submit-button, .secondary-button { min-height: 52px; border-radius: 999px; font-weight: 850; }
.submit-button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 18px; padding: 0 22px; border: 0; color: white; background: var(--orange); box-shadow: 0 12px 24px rgba(217,87,0,.19); }
.submit-button:hover { background: var(--orange-dark); }
.submit-button:disabled { cursor: wait; opacity: .6; }
.submit-button b { font-size: 1.3rem; }
.submit-button.compact { width: auto; min-height: 44px; }
.secondary-button { padding: 0 20px; border: 1px solid #d5c6bc; color: var(--ink); background: white; }
.privacy-note { margin: 16px 0 0; color: var(--muted); font-size: .67rem; text-align: center; }
.privacy-note a { color: var(--orange-dark); }
.form-error { margin: 15px 0; padding: 12px 15px; border: 1px solid #e7aaa5; border-radius: 12px; color: #812820; background: #fff0ef; font-size: .82rem; }
.success-panel { min-height: 680px; display: grid; place-items: center; align-content: center; padding: 60px; text-align: center; }
.success-panel .success-mark { display: grid; width: 72px; height: 72px; place-items: center; margin-bottom: 25px; border-radius: 50%; color: white; background: var(--green); font-size: 2.1rem; }
.success-panel h2 { max-width: 520px; margin: 0 0 16px; font-size: clamp(2.2rem, 4vw, 3.7rem); line-height: 1; letter-spacing: -.05em; }
.success-panel > p:not(.eyebrow) { color: var(--muted); }
.success-panel strong { color: var(--orange); }
.success-panel .secondary-button { margin-top: 20px; }

footer { width: min(1240px, calc(100% - 48px)); display: flex; justify-content: space-between; gap: 20px; padding: 25px 0 45px; margin-inline: auto; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }

/* Admin */
.admin-body { min-height: 100vh; color: #eaf1ed; background: var(--ink-deep); }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 15% 20%, rgba(217,87,0,.2), transparent 28rem), radial-gradient(circle at 85% 78%, rgba(31,103,79,.32), transparent 30rem), var(--ink-deep); }
.login-card { width: min(480px, 100%); padding: 50px; border: 1px solid rgba(255,255,255,.12); border-radius: 30px; background: rgba(255,255,255,.06); box-shadow: 0 35px 90px rgba(0,0,0,.25); text-align: center; }
.login-card > img { width: 68px; height: 68px; margin: 0 auto 25px; border-radius: 20px; }
.login-card h1 { margin: 0 0 14px; font-size: 3rem; line-height: 1; letter-spacing: -.06em; }
.login-card > p:not(.eyebrow) { margin-bottom: 28px; color: #b8c5be; }
.dashboard { min-height: 100vh; }
.admin-header { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 28px; border-bottom: 1px solid rgba(255,255,255,.1); }
.admin-account { display: flex; align-items: center; gap: 14px; color: #b7c4bd; font-size: .76rem; }
.admin-account button, .icon-button { border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: white; background: rgba(255,255,255,.06); }
.admin-account button { padding: 8px 12px; }
.admin-grid { min-height: calc(100vh - 75px); display: grid; grid-template-columns: 390px minmax(0, 1fr); }
.ticket-sidebar { border-right: 1px solid rgba(255,255,255,.1); }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 30px 26px 18px; }
.sidebar-heading h1 { margin: 0; font-size: 2.45rem; letter-spacing: -.05em; }
.sidebar-heading .eyebrow { margin-bottom: 5px; }
.icon-button { width: 39px; height: 39px; font-size: 1.2rem; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 0 22px 18px; }
.filters label, .status-control { display: grid; gap: 5px; }
.filters label > span, .status-control > span { color: #91a39a; font-size: .63rem; font-weight: 800; text-transform: uppercase; }
.filters select, .status-control select { min-height: 39px; padding: 0 10px; border-color: rgba(255,255,255,.15); color: #eef5f1; background: #22342c; font-size: .75rem; }
.ticket-list { border-top: 1px solid rgba(255,255,255,.08); }
.ticket-list-empty { padding: 42px 28px; color: #91a39a; text-align: center; }
.ticket-row { width: 100%; display: grid; gap: 8px; padding: 18px 24px; border: 0; border-bottom: 1px solid rgba(255,255,255,.07); color: inherit; background: transparent; text-align: left; }
.ticket-row:hover, .ticket-row.active { background: rgba(255,255,255,.065); }
.ticket-row.active { box-shadow: inset 3px 0 var(--orange); }
.ticket-row-top, .ticket-row-bottom { display: flex; justify-content: space-between; gap: 12px; }
.ticket-row-code { color: #e9a436; font-size: .64rem; font-weight: 900; letter-spacing: .08em; }
.ticket-row-time { color: #82948b; font-size: .62rem; }
.ticket-row strong { overflow: hidden; font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.ticket-row-bottom { align-items: center; }
.ticket-row-bottom span { color: #9bada4; font-size: .7rem; }
.status-pill { padding: 3px 8px; border-radius: 999px; color: #dce8e2 !important; background: rgba(255,255,255,.1); font-size: .58rem !important; font-weight: 800; }
.status-pill.new { color: #fff1e7 !important; background: rgba(217,87,0,.28); }
.status-pill.resolved { color: #d9f6e8 !important; background: rgba(46,139,87,.25); }
.ticket-empty { display: grid; place-items: center; align-content: center; padding: 40px; color: #8fa198; text-align: center; }
.ticket-empty span { color: rgba(255,255,255,.11); font-family: Georgia, serif; font-size: 8rem; line-height: 1; }
.ticket-empty h2 { margin: 25px 0 5px; color: #eef5f1; }
.ticket-empty p { margin: 0; }
.ticket-detail { min-width: 0; padding: 34px clamp(24px, 4vw, 58px) 80px; color: var(--ink); background: var(--paper); }
.detail-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 22px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.ticket-code { color: var(--orange); font-size: .72rem; font-weight: 900; letter-spacing: .1em; }
.detail-toolbar h2 { max-width: 760px; margin: 7px 0 0; font-size: clamp(2rem, 3.5vw, 3.5rem); line-height: 1; letter-spacing: -.055em; }
.status-control { min-width: 155px; }
.status-control select { color: var(--ink); background: white; border-color: var(--line); }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 0 8px; }
.ticket-meta span { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: white; font-size: .67rem; }
.conversation { display: grid; gap: 15px; padding: 22px 0 32px; }
.message { max-width: min(760px, 88%); padding: 20px 22px; border: 1px solid var(--line); border-radius: 20px 20px 20px 5px; background: white; }
.message.admin { justify-self: end; border-color: #cce1d5; border-radius: 20px 20px 5px 20px; background: var(--green-soft); }
.message-head { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 9px; color: var(--muted); font-size: .66rem; }
.message-head strong { color: var(--ink); }
.message p { margin: 0; white-space: pre-wrap; }
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; margin-top: 14px; }
.attachment-button { overflow: hidden; min-height: 120px; padding: 0; border: 1px solid var(--line); border-radius: 13px; background: var(--orange-soft); }
.attachment-button img { width: 100%; height: 140px; object-fit: cover; }
.response-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; }
.composer { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: white; }
.composer label { display: grid; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 12px; }
.composer-actions small { color: var(--muted); font-size: .68rem; }
.note-composer { align-self: start; background: #fff6dd; }
.note-composer .secondary-button { min-height: 42px; margin-top: 10px; }
.internal-notes { display: grid; gap: 8px; margin-bottom: 16px; }
.internal-note { padding: 11px 13px; border-left: 3px solid var(--amber); color: #5c4c32; background: #fff6dd; font-size: .76rem; }
.internal-note small { display: block; margin-top: 5px; color: #897759; }

@media (max-width: 960px) {
  .page-shell { grid-template-columns: 1fr; gap: 35px; }
  .intro { position: static; padding: 35px 0 0; }
  .intro h1 { max-width: 760px; }
  .admin-grid { grid-template-columns: 320px minmax(0,1fr); }
  .response-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar, .page-shell, footer { width: min(100% - 28px, 640px); }
  .topbar { min-height: 70px; }
  .secure-note { display: none; }
  .page-shell { margin-top: 10px; }
  .intro h1 { font-size: 3.7rem; }
  .promise-grid { grid-template-columns: 1fr; }
  .promise-grid article { display: grid; grid-template-columns: 35px 1fr; }
  .promise-grid span { grid-row: 1 / 3; margin: 0; }
  .category-grid { grid-template-columns: 1fr; }
  .field-title { display: grid; gap: 1px; }
  .preview-list { grid-template-columns: repeat(3, 1fr); }
  footer { display: grid; }
  .admin-header { padding: 0 15px; }
  .admin-account > span { display: none; }
  .admin-grid { display: block; }
  .ticket-sidebar { min-height: calc(100vh - 74px); border: 0; }
  .ticket-sidebar.has-selection { display: none; }
  .ticket-detail { min-height: calc(100vh - 74px); padding: 24px 16px 60px; }
  .ticket-detail::before { content: "← Danh sách phản hồi"; display: block; margin-bottom: 20px; color: var(--orange); font-size: .75rem; font-weight: 850; cursor: pointer; }
  .detail-toolbar { align-items: start; flex-direction: column; }
  .status-control { width: 100%; }
  .ticket-empty { display: none; }
  .response-grid { grid-template-columns: 1fr; }
  .login-card { padding: 36px 24px; }
}
