/* ===========================
   1. CSS CUSTOM PROPERTIES
   2. RESET & BASE
   3. TYPOGRAPHY
   4. LAYOUT (app shell, sidebar, topbar)
   5. LOGIN
   6. HERO
   7. DECORATIVE ART
   8. CONTENT SECTIONS
   9. CARDS, TILES, TABLES, FORMS
  10. FOOTER
  11. ANIMATIONS & KEYFRAMES
  12. RESPONSIVE
  13. ADMIN PANEL OVERLAY
=========================== */

/* 1. CUSTOM PROPERTIES */
:root {
  --bg-primary: #F7F5F0;          /* warm ivory */
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F4F8;
  --panel: #FFFFFF;
  --panel-strong: #F4F6FA;
  --line: #E7E9EF;
  --line-strong: #D5DAE3;
  --accent: #1F3864;              /* CAT navy — primary */
  --accent-glow: rgba(31, 56, 100, 0.16);
  --accent-2: #C55A11;            /* Metro orange — calls to action */
  --accent-2-glow: rgba(197, 90, 17, 0.20);
  --gold: #B8892B;                /* luxury gold detail */
  --gold-soft: rgba(184, 137, 43, 0.12);
  --navy: #1F3864;
  --sky: #D5E8F0;
  --sky-soft: rgba(213, 232, 240, 0.7);
  --good: #17845A;
  --good-soft: rgba(23, 132, 90, 0.10);
  --bad: #C2312F;
  --bad-soft: rgba(194, 49, 47, 0.08);
  --warn: #B26A00;
  --text-primary: #0F1B33;
  --text-secondary: #56627A;
  --text-muted: #8A94A6;
  --font-display: 'Playfair Display', 'Noto Serif Thai', Georgia, serif;
  --font-body: 'Kanit', system-ui, sans-serif;
  --font-num: 'Playfair Display', 'Kanit', Georgia, serif;
  --shadow-sm: 0 1px 2px rgba(15, 27, 51, 0.04), 0 4px 16px rgba(15, 27, 51, 0.04);
  --shadow-lg: 0 24px 60px rgba(15, 27, 51, 0.10);
  --max-width: 1440px;
  --section-padding: clamp(20px, 3vw, 40px);
  --border-radius: 18px;
  --radius-sm: 10px;
  --side-w: 264px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. RESET & BASE */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--navy); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
b, strong { font-weight: 500; }
img { max-width: 100%; display: block; }
::selection { background: var(--sky); color: var(--navy); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(15,27,51,0.14); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* 3. TYPOGRAPHY */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.text-gradient {
  background: linear-gradient(120deg, var(--gold) 0%, #C9822A 55%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); } .muted { color: var(--text-muted); }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-secondary); }
.eyebrow__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); animation: pulse 2.4s ease-in-out infinite; }
.section-title { font-size: 22px; margin: 32px 0 16px; padding-left: 14px; border-left: 3px solid var(--gold); }

/* 4. LAYOUT */
.app { display: flex; min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
  background: #FFFFFF;
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 30px rgba(15,27,51,0.03);
  padding: 20px 14px;
  transition: transform var(--transition);
}
.side__brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; border-bottom: 1px solid var(--line); }
.side__title { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.1; }
.side__sub { font-size: 12px; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; }
.side__nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 6px; }
.side__group { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); padding: 16px 12px 6px; }
.side__link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 14.5px; position: relative;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.side__link .ic { width: 20px; text-align: center; color: var(--text-muted); transition: color var(--transition); }
.side__link:hover { background: var(--panel-strong); color: var(--text-primary); transform: translateX(2px); }
.side__link.is-active { background: linear-gradient(90deg, var(--sky-soft), rgba(213,232,240,0.15)); color: var(--navy); font-weight: 400; }
.side__link.is-active::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--gold); }
.side__link.is-active .ic { color: var(--navy); }
.side__me { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.side__avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy), #3A5A94); color: #fff; font-weight: 600; flex: none; }
.side__who { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.25; }
.side__who > div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__role { font-size: 11.5px; color: var(--text-muted); }
.icon-btn { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; color: var(--text-secondary); transition: all var(--transition); flex: none; }
.icon-btn:hover { color: var(--accent-2); border-color: var(--accent-2); }

.main { flex: 1; margin-left: var(--side-w); min-width: 0; padding: 0 var(--section-padding) var(--section-padding); max-width: calc(var(--max-width) + var(--side-w)); }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px; padding: 16px 0; background: rgba(247, 245, 240, 0.82); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid transparent; transition: border-color var(--transition); }
.topbar.topbar--scrolled { border-bottom-color: var(--line); }
.topbar__menu { display: none; }
.topbar__crumb { font-weight: 500; font-size: 15px; flex: 1; }
.topbar__period { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.topbar__period .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }

.view { padding-top: 8px; animation: view-in .45s ease both; }
.view__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 8px 0 20px; }
.view__title { font-size: clamp(30px, 3.6vw, 48px); font-weight: 600; letter-spacing: -0.015em; line-height: 1.12; color: var(--navy); }
.view__sub { color: var(--text-secondary); margin: 6px 0 0; max-width: 72ch; }
.grid2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); margin-bottom: 18px; }
.grid3 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); margin-bottom: 18px; }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); margin-bottom: 18px; }
.filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter select, .filter input { background: #FFFFFF; box-shadow: var(--shadow-sm); border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 16px; min-width: 170px; color: var(--text-primary); }
.filter select option, .field select option { background: #FFFFFF; color: var(--text-primary); }

/* 5. LOGIN */
.login { position: relative; min-height: 100vh; display: grid; place-items: center; overflow: hidden; padding: 24px; }
.login__inner { position: relative; z-index: 2; width: min(440px, 100%); text-align: center; }
.login__brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login__dept { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-secondary); }
.login__title { font-size: clamp(42px, 7vw, 68px); font-weight: 600; line-height: 1.04; letter-spacing: -0.02em; color: var(--navy); display: flex; flex-direction: column; }
.login__sub { color: var(--text-secondary); margin: 14px 0 28px; }
.login__card { padding: 28px; text-align: left; display: flex; flex-direction: column; gap: 14px; }
.login__foot { color: var(--text-muted); font-size: 12px; margin-top: 22px; }
.login__orb1 { top: -160px; right: -120px; }
.login__orb2 { bottom: -200px; left: -160px; }

/* 6. HERO */
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: clamp(28px, 4vw, 56px); margin: 6px 0 18px; border: 1px solid var(--line); background: linear-gradient(135deg, #FFFFFF 0%, #FBFAF6 55%, #EEF5F9 100%); min-height: 380px; box-shadow: var(--shadow-lg); display: flex; align-items: flex-end; }
.hero__img { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1s ease; }
.hero__img.is-loaded { opacity: .9; }
.hero__img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.97) 0%, rgba(255,255,255,.85) 45%, rgba(255,255,255,.2) 100%); }
.hero__orb1 { width: 520px; height: 520px; top: -220px; right: -120px; }
.hero__orb2 { width: 420px; height: 420px; bottom: -240px; left: 20%; }
.hero__lines { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--gold); opacity: .45; pointer-events: none; }
.hero__lines path { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.6s .3s ease forwards; }
.hero__content { position: relative; z-index: 2; width: 100%; }
.hero__title { font-size: clamp(44px, 6.6vw, 100px); font-weight: 600; line-height: 1.02; letter-spacing: -0.02em; margin: 16px 0 14px;
  background: linear-gradient(110deg, var(--navy) 0%, var(--navy) 58%, var(--gold) 84%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero__sub { color: var(--text-secondary); font-size: clamp(15px, 1.4vw, 18px); max-width: 60ch; margin: 0 0 28px; }
.hero__kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); max-width: 860px; }
.kpi { padding: 18px 20px; border-radius: var(--border-radius); background: rgba(255,255,255,0.78); border: 1px solid var(--line); box-shadow: var(--shadow-sm); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.kpi__label { font-size: 12.5px; color: var(--text-secondary); }
.kpi__value { font-family: var(--font-num); color: var(--navy); font-size: clamp(32px, 3.4vw, 46px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.kpi--alert .kpi__value { color: var(--bad); }
.kpi__delta { font-size: 12.5px; color: var(--text-secondary); }

/* 7. DECORATIVE ART */
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.75; pointer-events: none; animation: float 14s ease-in-out infinite; }
.orb--primary { width: 600px; height: 600px; background: radial-gradient(circle, rgba(213,232,240,0.95), transparent 70%); }
.orb--secondary { width: 520px; height: 520px; background: radial-gradient(circle, rgba(184,137,43,0.22), transparent 70%); animation-delay: -6s; }
.grid-overlay { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(31,56,100,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(31,56,100,0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at 70% 30%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse at 70% 30%, #000 20%, transparent 75%); }
.noise-overlay { position: absolute; inset: 0; opacity: 0.025; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.blob { position: absolute; border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; opacity: 0.15; animation: blob-morph 8s ease-in-out infinite; pointer-events: none; }
.logo-chip { display: inline-flex; align-items: center; gap: 4px; background: #FFCD11; color: #000; font-weight: 600; font-size: 12.5px; letter-spacing: .06em; padding: 4px 9px; border-radius: 6px; white-space: nowrap; }
.logo-chip b { background: #000; color: #FFCD11; padding: 0 5px; border-radius: 3px; font-weight: 700; }
.logo-chip--sm { font-size: 10.5px; padding: 2px 7px; }
.glass { background: rgba(255,255,255,0.82); border: 1px solid var(--line); border-radius: 22px; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: var(--shadow-lg); }

/* 8. CONTENT SECTIONS */
.keymsg { display: flex; gap: 16px; align-items: flex-start; padding: 20px 24px; border-radius: var(--border-radius); background: linear-gradient(90deg, #FFFFFF, #FBF7EE); border: 1px solid rgba(184,137,43,0.30); box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.keymsg__tag { flex: none; font-size: 11px; font-weight: 500; letter-spacing: .16em; background: var(--navy); color: #fff; padding: 4px 10px; border-radius: 6px; margin-top: 2px; }
.keymsg p { margin: 0; font-family: var(--font-display); font-size: 17px; line-height: 1.5; color: var(--navy); }
.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); margin-bottom: 18px; }
.steps--5 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.step { padding: 20px; border-radius: var(--border-radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform var(--transition), border-color var(--transition); }
.step::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--navy), var(--gold)); }
.step:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.step__n { font-size: 11.5px; letter-spacing: .12em; color: var(--gold); font-weight: 500; }
.step__h { font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--navy); margin: 4px 0 6px; }
.step p { margin: 0; font-size: 13.5px; color: var(--text-secondary); }
.policy-hero { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; justify-content: space-between; padding: clamp(24px, 3vw, 40px); border-radius: 24px; border: 1px solid var(--line); background: linear-gradient(135deg, #FFFFFF 0%, #FBFAF6 60%, #EEF5F9 100%); box-shadow: var(--shadow-lg); margin: 6px 0 18px; }
.policy-hero__orb { width: 420px; height: 420px; right: -120px; top: -200px; }
.policy-hero__text { position: relative; z-index: 1; max-width: 820px; }
.policy-hero .btn-primary { position: relative; z-index: 1; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { position: relative; padding-left: 26px; color: var(--text-secondary); font-size: 14px; }
.checklist li::before { content: ''; position: absolute; left: 0; top: 7px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--gold); }
.checklist b { color: var(--text-primary); }
.empty { text-align: center; padding: clamp(32px, 5vw, 64px) 24px; }
.empty__icon { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 22px; display: grid; place-items: center; font-size: 30px; background: linear-gradient(135deg, var(--sky), #FBF7EE); border: 1px solid var(--line); color: var(--navy); }
.empty h3 { font-size: 22px; margin-bottom: 8px; }
.empty p { color: var(--text-secondary); max-width: 60ch; margin: 0 auto 10px; }
.code-cols { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 14px 0 20px; }
.code-cols span { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-secondary); }

/* 9. CARDS, TILES, TABLES, FORMS */
.card { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: var(--border-radius); padding: clamp(18px, 2vw, 28px); min-width: 0; margin-bottom: 18px; position: relative; transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition); }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.card:hover { box-shadow: var(--shadow-lg); }
.card--pos { border-top: 2px solid var(--good); } .card--neg { border-top: 2px solid var(--bad); }
.card__head { margin-bottom: 14px; }
.card__head h3 { font-size: 19px; color: var(--navy); }
.card__head p, .card__note { margin: 3px 0 0; color: var(--text-muted); font-size: 12.5px; }
.card__note { margin-top: 12px; }
.tile { padding: 18px 20px; border-radius: var(--border-radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform var(--transition), border-color var(--transition); }
.tile::after { content: ''; position: absolute; top: 0; left: 20px; width: 34px; height: 3px; background: var(--gold); border-radius: 0 0 3px 3px; }
.tile--alert::after { background: var(--bad); }
.tile--good::after { background: var(--good); }
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.tile__label { font-size: 12.5px; color: var(--text-secondary); }
.tile__value { font-family: var(--font-num); color: var(--navy); font-size: clamp(26px, 2.4vw, 34px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; margin: 2px 0; }
.tile--alert .tile__value { color: var(--bad); } .tile--good .tile__value { color: var(--good); }
.tile__note { font-size: 12px; color: var(--text-muted); }

.chart { position: relative; min-height: 240px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--text-secondary); font-family: var(--font-body); font-size: 11.5px; }
.chart .lbl-strong { fill: var(--text-primary); }
.chart .grid line { stroke: #EDEFF3; }
.chart .axis { stroke: #C9D0DB; }
.chart .bar { transition: opacity var(--transition); }
.chart .hit { fill: transparent; cursor: default; }
.chart g.row:hover .bar { opacity: .82; }
.tip { position: fixed; z-index: 600; pointer-events: none; background: #FFFFFF; color: var(--text-primary); border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; font-size: 12.5px; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .15s ease; max-width: 280px; }
.tip.is-on { opacity: 1; }
.tip .k { color: var(--text-muted); font-size: 11.5px; }

.tablewrap { overflow: auto; max-height: 600px; border-radius: var(--radius-sm); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { position: sticky; top: 0; z-index: 1; background: #F6F8FB; color: var(--text-secondary); font-weight: 400; font-size: 12px; text-align: left; padding: 9px 10px; white-space: nowrap; border-bottom: 1px solid var(--line-strong); cursor: default; }
table.t th.sortable { cursor: pointer; } table.t th.sortable:hover { color: var(--accent-2); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td.r, table.t th.r { text-align: right; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
table.t td.wrap { white-space: normal; min-width: 180px; }
table.t--wrap td { white-space: normal; }
.tile__value--text { font-family: var(--font-display); font-size: 20px; font-weight: 500; line-height: 1.3; }
input[type=file] { color: var(--text-secondary); font-size: 13px; }
input[type=file]::file-selector-button { margin-right: 12px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: #FFFFFF; color: var(--text-primary); cursor: pointer; transition: all var(--transition); }
input[type=file]::file-selector-button:hover { border-color: var(--accent-2); color: var(--accent-2); }
table.t tbody tr { transition: background var(--transition); }
table.t tbody tr:hover td { background: #FAFBFD; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: rgba(213,232,240,0.45); }
table.t tfoot td { font-weight: 500; border-top: 1px solid var(--line-strong); border-bottom: 0; }
table.t--center td, table.t--center th { text-align: center; } table.t--center td:first-child, table.t--center th:first-child { text-align: left; }
.tick { color: var(--gold); }
.heat { display: inline-block; min-width: 52px; text-align: center; padding: 2px 8px; border-radius: 6px; font-family: var(--font-body); }
.inbar { display: inline-block; height: 6px; border-radius: 4px; vertical-align: middle; margin-left: 8px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; white-space: nowrap; border: 1px solid transparent; }
.pill--bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(255,90,102,.3); }
.pill--good { background: var(--good-soft); color: var(--good); border-color: rgba(61,220,151,.3); }
.pill--warn { background: rgba(255,181,71,.14); color: var(--warn); border-color: rgba(255,181,71,.3); }
.pill--muted { background: var(--panel-strong); color: var(--text-secondary); border-color: var(--line-strong); }
.s-Submitted { background: var(--sky-soft); color: var(--navy); } .s-Reviewed { background: var(--good-soft); color: var(--good); } .s-Revision { background: var(--bad-soft); color: var(--bad); } .s-Draft { background: var(--panel-strong); color: var(--text-secondary); }

.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 28px; background: var(--navy); color: #fff; font-weight: 600; font-size: 14.5px; letter-spacing: .01em; border: 0; border-radius: 100px; cursor: pointer; text-decoration: none; transition: all var(--transition); position: relative; overflow: hidden; white-space: nowrap; }
.btn-primary::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.25); transform: translateX(-100%); transition: transform var(--transition); }
.btn-primary:hover::before { transform: translateX(0); }
.btn-primary:hover { transform: translateY(-2px); background: var(--accent-2); box-shadow: 0 16px 36px var(--accent-2-glow); }
.btn-primary:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.btn--block { width: 100%; }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; background: #FFFFFF; color: var(--text-primary); border: 1px solid var(--line-strong); border-radius: 100px; cursor: pointer; font-size: 13.5px; transition: all var(--transition); white-space: nowrap; }
.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent-2); transform: translateY(-1px); }
.btn-ghost:disabled { opacity: .5; cursor: default; }
.btn-danger { border-color: rgba(255,90,102,.4); color: var(--bad); }
.btn--sm { padding: 5px 12px; font-size: 12.5px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .field > label { font-size: 12.5px; color: var(--text-secondary); }
.field.req > span::after { content: ' *'; color: var(--bad); }
.field input, .field select, .field textarea, table.edit input, table.edit select {
  width: 100%; background: #FFFDF5; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text-primary); transition: border-color var(--transition), box-shadow var(--transition); }
.field input:focus, .field select:focus, .field textarea:focus, table.edit input:focus, table.edit select:focus, .filter select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--accent-glow); }
.field textarea { min-height: 70px; resize: vertical; }
input[type=date], input[type=month] { color-scheme: light; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.sec { margin: 24px 0 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--sky-soft), rgba(213,232,240,0.1)); border-left: 3px solid var(--gold); font-weight: 500; color: var(--navy); }
.sec small { display: block; color: var(--text-muted); font-weight: 300; font-size: 12px; }
table.edit td { padding: 4px; } table.edit input, table.edit select { min-width: 110px; padding: 7px 8px; font-size: 13px; }
.xbtn { background: transparent; border: 0; color: var(--bad); cursor: pointer; font-size: 18px; }
.msg { padding: 11px 15px; border-radius: var(--radius-sm); font-size: 14px; }
.msg--err { background: var(--bad-soft); color: var(--bad); border: 1px solid rgba(255,90,102,.3); }
.msg--ok { background: var(--good-soft); color: var(--good); border: 1px solid rgba(61,220,151,.3); }
.flash { position: sticky; top: 72px; z-index: 40; margin: 4px 0 12px; }
.formcards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); }
.formcard { text-align: left; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: var(--border-radius); padding: 18px; cursor: pointer; position: relative; overflow: hidden; transition: all var(--transition); }
.formcard::after { content: '→'; position: absolute; right: 18px; top: 18px; color: var(--accent-2); opacity: 0; transform: translateX(-6px); transition: all var(--transition); }
.formcard:hover { border-color: rgba(184,137,43,.45); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.formcard:hover::after { opacity: 1; transform: none; }
.formcard__n { font-size: 11.5px; color: var(--gold); letter-spacing: .08em; }
.formcard__h { font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--navy); margin: 4px 0; }
.formcard__d { font-size: 13px; color: var(--text-secondary); }
.kv { display: grid; grid-template-columns: minmax(140px, 32%) 1fr; gap: 6px 14px; font-size: 14px; }
.kv > div:nth-child(odd) { color: var(--text-muted); }
.comment { border-left: 2px solid var(--gold); padding: 4px 12px; margin: 8px 0; font-size: 14px; }
.comment__m { font-size: 11.5px; color: var(--text-muted); }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 14px; margin: 18px -24px -24px; background: rgba(255,255,255,0.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); border-radius: 0 0 var(--border-radius) var(--border-radius); }
.doc { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: var(--border-radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: all var(--transition); }
.doc:hover { border-color: rgba(184,137,43,.45); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.doc__ic { width: 42px; height: 50px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(160deg, var(--navy), #3A5A94); }
.doc__t { font-weight: 500; } .doc__s { font-size: 12px; color: var(--text-muted); }
.cell-ok { background: var(--good-soft); color: var(--good); text-align: center; } .cell-bad { background: var(--bad-soft); color: var(--bad); text-align: center; } .cell-mid { background: rgba(255,181,71,.14); color: var(--warn); text-align: center; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--border-radius); padding: 30px; text-align: center; color: var(--text-secondary); transition: all var(--transition); cursor: pointer; }
.dropzone:hover, .dropzone.is-over { border-color: var(--gold); background: #FBF7EE; color: var(--text-primary); }

/* 10. FOOTER */
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 28px 0 8px; margin-top: 18px; border-top: 1px solid var(--line); color: var(--text-muted); font-size: 12px; }
.foot__src { margin-left: auto; }

/* 11. ANIMATIONS */
[data-animate] { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
[data-animate].is-visible { opacity: 1; transform: translateY(0); }
.tiles > [data-animate]:nth-child(2), .grid2 > [data-animate]:nth-child(2), .steps > [data-animate]:nth-child(2) { transition-delay: .08s; }
.tiles > [data-animate]:nth-child(3), .steps > [data-animate]:nth-child(3) { transition-delay: .16s; }
.tiles > [data-animate]:nth-child(4), .steps > [data-animate]:nth-child(4) { transition-delay: .24s; }
.tiles > [data-animate]:nth-child(5), .steps > [data-animate]:nth-child(5) { transition-delay: .32s; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(.8); } }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(30px, 20px); } }
@keyframes blob-morph { 0%, 100% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; } 50% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.anim-x { transform-box: fill-box; transform-origin: left center; animation: grow-x .9s cubic-bezier(.2,.8,.2,1) both; }
.anim-x-neg { transform-box: fill-box; transform-origin: right center; animation: grow-x .9s cubic-bezier(.2,.8,.2,1) both; }
.anim-y { transform-box: fill-box; transform-origin: center bottom; animation: grow-y .9s cubic-bezier(.2,.8,.2,1) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-animate] { opacity: 1; transform: none; }
}

/* 12. RESPONSIVE */
@media (max-width: 1024px) {
  .side { transform: translateX(-100%); box-shadow: 30px 0 60px rgba(15,27,51,.12); }
  .side.is-open { transform: none; }
  .main { margin-left: 0; }
  .topbar__menu { display: grid; }
}
@media (max-width: 768px) {
  body { font-size: 14.5px; }
  .hero { min-height: 0; border-radius: 18px; }
  .grid2 { grid-template-columns: 1fr; }
  .sticky-actions { margin: 18px -16px -16px; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { margin-top: 8px; }
  .keymsg { flex-direction: column; gap: 8px; }
}
@media (max-width: 480px) {
  .main { padding: 0 14px 14px; }
  .topbar__period span:last-child { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile__value { font-size: 22px; }
  .filter select { min-width: 0; width: 100%; }
  .foot__src { margin-left: 0; }
}

/* 12b. LANGUAGE TOGGLE */
.lang { display: inline-flex; padding: 3px; border-radius: 999px; background: #FFFFFF; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.lang__btn { border: 0; background: transparent; color: var(--text-secondary); font-size: 12.5px; font-weight: 500; padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: all var(--transition); }
.lang__btn:hover { color: var(--navy); }
.lang__btn.is-on { background: var(--navy); color: #fff; }
.lang--float { position: absolute; top: 20px; right: 20px; z-index: 5; }

/* 12c. VISIT PLANS */
.rmgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin-bottom: 18px; }
.rmcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--border-radius); padding: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; transition: transform var(--transition), box-shadow var(--transition); }
.rmcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.rmcard--missing { border-style: dashed; border-color: rgba(194,49,47,.35); background: #FFFCFB; }
.rmcard--selected { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft), var(--shadow-sm); }
.rmcard__top { display: flex; align-items: center; gap: 12px; }
.rmcard__av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; background: linear-gradient(135deg, var(--navy), #3A5A94); flex: none; }
.rmcard--missing .rmcard__av { background: linear-gradient(135deg, #C9CED8, #AEB5C2); }
.rmcard__name { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--navy); line-height: 1.15; }
.rmcard__region { font-size: 12.5px; color: var(--text-muted); }
.rmcard__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rmcard__stat { background: var(--bg-tertiary); border-radius: 10px; padding: 7px 8px; text-align: center; }
.rmcard__stat b { display: block; font-family: var(--font-num); font-size: 18px; color: var(--navy); line-height: 1.2; }
.rmcard__stat span { font-size: 10.5px; color: var(--text-muted); }
.rmcard__flags { display: flex; flex-wrap: wrap; gap: 5px; }
.rmcard__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal__head { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); text-align: center; padding: 4px 0; }
.cal__cell { min-height: 118px; border-radius: 12px; border: 1px solid var(--line); background: #FFFFFF; padding: 8px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; border-top-width: 3px; min-width: 0; }
.cal__cell--blank { background: transparent; border: 0; }
.cal__d { display: flex; justify-content: space-between; align-items: baseline; }
.cal__d b { font-family: var(--font-num); font-size: 16px; color: var(--navy); }
.cal__place { color: var(--text-secondary); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__act { color: var(--text-muted); font-size: 11px; line-height: 1.3; }
.cal__cust { font-size: 11.5px; line-height: 1.3; color: var(--text-primary); }
.cal__cust .v { color: var(--gold); font-weight: 500; }
.cal__cust.is-priority { color: var(--accent-2); font-weight: 500; }
.t-visit { border-top-color: var(--navy); } .t-meeting { border-top-color: #8FB8CF; } .t-admin { border-top-color: #B9C0CC; }
.t-travel { border-top-color: var(--gold); } .t-leave { border-top-color: #E39A8E; background: #FFF8F6; } .t-off { border-top-color: #E1E4EA; background: #FAFAF8; }
.t-tbc { border-top-color: var(--bad); background: #FFF9F7; } .t-empty { border-top-color: #E1E4EA; background: #FBFBFB; }
.tchip { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: var(--bg-tertiary); color: var(--text-secondary); white-space: nowrap; }
.tchip--visit { background: rgba(31,56,100,.1); color: var(--navy); } .tchip--tbc { background: var(--bad-soft); color: var(--bad); }
.tchip--leave { background: rgba(227,154,142,.18); color: #B4553F; } .tchip--travel { background: var(--gold-soft); color: var(--gold); }
.tier { display: inline-block; font-size: 9.5px; font-weight: 600; letter-spacing: .04em; padding: 0 5px; border-radius: 4px; margin-right: 3px; vertical-align: 1px; }
.tier--VIP { background: var(--navy); color: #fff; } .tier--KA { background: var(--sky); color: var(--navy); } .tier--Priority { background: var(--accent-2); color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-secondary); margin: 6px 0 14px; }
.legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.planform td { vertical-align: top; }
.planform .day { font-family: var(--font-num); color: var(--navy); font-weight: 600; white-space: nowrap; }
.planform tr.is-weekend td { background: #FAF9F5; }
.custrow { display: grid; grid-template-columns: minmax(140px, 1fr) 90px minmax(110px, 0.8fr) 110px 28px; gap: 4px; margin-bottom: 4px; }
.custrow input, .custrow select { min-width: 0 !important; }
.callout { display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px; border-radius: var(--border-radius); background: #FFF8F6; border: 1px solid rgba(194,49,47,.25); margin-bottom: 18px; }
.callout b { color: var(--bad); }
@media (max-width: 900px) { .cal { grid-template-columns: 1fr; } .cal__head, .cal__cell--blank { display: none; } .cal__cell { min-height: 0; } }

.chkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 6px 0 10px; }
.chk { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; cursor: pointer; font-size: 13.5px; color: var(--text-primary); }
.chk input { accent-color: var(--navy); width: 16px; height: 16px; }
.chk:has(input:checked) { border-color: var(--navy); background: var(--sky-soft); }

/* 12d. BRAND LOGO + THAI TYPE FIXES */
.brand-logo { display: block; height: 35px; width: auto; flex: none; }
.brand-logo--sm { height: 24px; }
.side__brand { flex-direction: column; align-items: flex-start; gap: 8px; }
.side__brand .brand-logo { height: 30px; }
.side__title { white-space: nowrap; }
.login__brand .brand-logo { height: 40px; }
/* Gradient text is clipped to its own box: give Thai tone marks and lower vowels room above and below */
.hero__title, .text-gradient { padding: 0.14em 0 0.12em; }
.hero__title { line-height: 1.12; }
html[lang="th"] .hero__title { line-height: 1.32; font-size: clamp(40px, 5.8vw, 88px); letter-spacing: 0; }
html[lang="th"] .view__title, html[lang="th"] .login__title { line-height: 1.3; letter-spacing: 0; }
html[lang="th"] h1, html[lang="th"] h2, html[lang="th"] h3 { letter-spacing: 0; }
html[lang="th"] .eyebrow, html[lang="th"] .side__group { letter-spacing: .04em; }

/* 13. ADMIN PANEL OVERLAY */
.admin-fab { position: fixed; bottom: 96px; right: 24px; z-index: 9999; display: flex; gap: 10px; }
.admin-fab button { border: 0; border-radius: 100px; padding: 12px 20px; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 8px 32px rgba(15,27,51,0.2); transition: all var(--transition); }
.admin-fab__edit { background: var(--navy); color: #fff; }
.admin-fab__edit.is-on { background: var(--bad); color: #fff; }
.admin-fab__save { background: var(--good); color: #fff; }
.admin-fab button:hover { transform: translateY(-2px); }
body.is-editing [data-editable="true"] { outline: 2px dashed rgba(197,90,17,0.6); outline-offset: 4px; border-radius: 4px; cursor: text; }
body.is-editing [data-editable="true"]:focus { outline-style: solid; background: rgba(197,90,17,0.05); }
.admin-toast { position: fixed; bottom: 156px; right: 24px; z-index: 9999; background: #1F2937; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 13px; opacity: 0; transition: opacity .3s ease; pointer-events: none; max-width: 320px; }
.admin-toast.is-on { opacity: 1; }
