:root {
  --ink: #173432;
  --muted: #667c7a;
  --line: #dce8e6;
  --soft: #f2f8f7;
  --primary: #0b6a65;
  --primary-dark: #074f4c;
  --accent: #d4f08a;
  --white: #fff;
  --danger: #b42318;
  --success: #117a53;
  --warning: #9a6700;
  --shadow: 0 24px 70px rgba(13, 71, 68, .14);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: #fbfdfc; font-family: Inter, "Noto Sans Thai", "Segoe UI", Tahoma, sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }
.view { min-height: calc(100vh - 76px); }

.site-header { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; height: 76px; padding: 0 clamp(20px, 5vw, 76px); border-bottom: 1px solid rgba(211, 226, 224, .8); background: rgba(251, 253, 252, .9); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand > span:last-child { display: grid; }
.brand strong { font-size: 19px; letter-spacing: -.3px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 9px; letter-spacing: 1px; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #fff; background: linear-gradient(145deg, var(--primary), #109b91); box-shadow: 0 8px 20px rgba(11, 106, 101, .24); font-weight: 800; letter-spacing: -1px; }
.brand.inverse { color: #fff; }
.brand.inverse small { color: rgba(255,255,255,.66); }
.brand-mark.light { color: var(--primary-dark); background: var(--accent); box-shadow: none; }
.top-nav { display: flex; align-items: center; gap: 10px; }
.nav-link { padding: 10px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 19px; border: 1px solid transparent; border-radius: 12px; text-decoration: none; font-weight: 700; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .58; cursor: wait; transform: none; }
.button.primary { color: #fff; background: linear-gradient(135deg, var(--primary), #0e827a); box-shadow: 0 8px 20px rgba(11,106,101,.22); }
.button.primary:hover { box-shadow: 0 12px 28px rgba(11,106,101,.28); }
.button.ghost { border-color: var(--line); color: var(--primary-dark); background: #fff; }
.button.light { border-color: rgba(255,255,255,.5); color: #fff; background: rgba(255,255,255,.12); }
.button.white { color: var(--primary-dark); background: #fff; box-shadow: 0 10px 26px rgba(0,0,0,.14); }
.button.small { min-height: 39px; padding: 0 15px; font-size: 13px; }
.button.large { min-height: 52px; padding: 0 25px; }
.button.full-width { grid-column: 1 / -1; width: 100%; min-height: 52px; justify-content: space-between; margin-top: 5px; padding-inline: 20px; }

.hero-shell { position: relative; display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(390px, .98fr); align-items: center; gap: clamp(35px, 7vw, 100px); min-height: 690px; padding: 75px clamp(24px, 7vw, 110px); overflow: hidden; color: #fff; background: radial-gradient(circle at 78% 15%, rgba(114, 225, 204, .26), transparent 31%), linear-gradient(125deg, #073f3e 0%, #075b57 53%, #087168 100%); }
.hero-shell::before { position: absolute; inset: auto auto -190px -130px; width: 460px; height: 460px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; content: ""; box-shadow: 0 0 0 75px rgba(255,255,255,.025), 0 0 0 145px rgba(255,255,255,.02); }
.hero-copy { position: relative; z-index: 1; max-width: 650px; }
.eyebrow { margin: 0 0 14px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: 2px; }
.hero-copy .eyebrow { color: var(--accent); }
.hero-copy h1 { margin: 0; font-size: clamp(42px, 5vw, 72px); line-height: 1.08; letter-spacing: -2.2px; }
.hero-copy h1 span { color: var(--accent); }
.hero-lead { max-width: 590px; margin: 25px 0 0; color: rgba(255,255,255,.78); font-size: clamp(17px, 1.4vw, 20px); line-height: 1.8; }
.hero-actions { display: flex; gap: 12px; margin-top: 34px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 31px; color: rgba(255,255,255,.7); font-size: 12px; }

.poster-card { position: relative; z-index: 1; min-height: 470px; padding: 22px; border: 1px solid rgba(255,255,255,.42); border-radius: 28px; color: var(--ink); background: rgba(255,255,255,.94); box-shadow: 0 36px 85px rgba(0,0,0,.28); transform: rotate(1.3deg); }
.poster-card::after { position: absolute; inset: -12px 18px auto auto; width: 72px; height: 72px; border-radius: 22px; background: var(--accent); filter: blur(1px); content: ""; z-index: -1; }
.poster-top { display: flex; align-items: center; gap: 11px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.poster-top > div { display: grid; flex: 1; }
.poster-top small { margin-top: 3px; color: var(--muted); }
.poster-logo { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #fff; background: var(--primary); font-weight: 800; }
.status-dot { padding: 6px 9px; border-radius: 999px; color: var(--success); background: #eaf8f1; font-size: 10px; font-weight: 800; }
.poster-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; padding: 21px 0; }
.mini-app { display: grid; min-height: 104px; padding: 15px; border: 1px solid rgba(0,0,0,.04); border-radius: 17px; }
.mini-app span { font-size: 24px; }
.mini-app strong { margin-top: 8px; font-size: 13px; }
.mini-app small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.turquoise { background: #e6f7f4; }
.blue { background: #eaf2ff; }
.purple { background: #f1edff; }
.orange { background: #fff1e3; }
.green { background: #ecf7e6; }
.neutral { background: #f3f5f5; }
.poster-footer { display: flex; align-items: center; justify-content: space-between; padding: 15px 4px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.poster-footer strong { padding: 5px 9px; border-radius: 999px; color: var(--warning); background: #fff5cf; font-size: 9px; }

.section-shell { max-width: 1240px; margin: auto; padding: 100px 28px; }
.section-heading { max-width: 690px; margin: 0 auto 48px; text-align: center; }
.section-heading.compact { margin-bottom: 38px; }
.section-heading h2 { margin: 0; font-size: clamp(30px, 3vw, 44px); letter-spacing: -1.1px; }
.section-heading p:last-child { color: var(--muted); line-height: 1.75; }
.feature-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; }
.feature-grid article { min-height: 235px; padding: 24px 20px; border: 1px solid var(--line); border-radius: 20px; background: #fff; transition: transform .2s ease, box-shadow .2s ease; }
.feature-grid article:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(22,72,69,.09); }
.feature-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; font-size: 24px; }
.feature-grid h3 { margin: 20px 0 8px; font-size: 17px; }
.feature-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.role-section { padding-top: 40px; }
.role-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: center; gap: 13px; }
.role-flow > div { min-height: 125px; padding: 24px 18px; border-radius: 18px; color: #fff; background: linear-gradient(145deg, #0a5b57, #0a7670); }
.role-flow strong, .role-flow span { display: block; }
.role-flow span { margin-top: 8px; color: rgba(255,255,255,.72); font-size: 12px; line-height: 1.6; }
.role-flow b { color: #85aaa7; font-size: 28px; }
.cta-section { padding: 90px 28px; text-align: center; color: #fff; background: linear-gradient(135deg, #07514e, #0b7770); }
.cta-section .eyebrow { color: var(--accent); }
.cta-section h2 { margin: 0; font-size: clamp(30px, 4vw, 48px); }
.cta-section p:not(.eyebrow) { margin: 13px 0 28px; color: rgba(255,255,255,.72); }
.site-footer { display: flex; justify-content: space-between; padding: 25px clamp(20px, 5vw, 76px); border-top: 1px solid var(--line); color: var(--muted); background: #fff; font-size: 11px; }

.auth-page { display: grid; grid-template-columns: minmax(320px, .84fr) minmax(500px, 1.16fr); min-height: 100vh; }
.auth-page + .site-footer { display: none; }
.auth-visual { display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: clamp(35px, 5vw, 70px); color: #fff; background: radial-gradient(circle at 20% 80%, rgba(207,238,128,.18), transparent 30%), linear-gradient(150deg, #073f3e, #08726b); }
.auth-visual h2 { max-width: 580px; margin: 0 0 18px; font-size: clamp(36px, 4vw, 62px); line-height: 1.1; letter-spacing: -1.8px; }
.auth-visual p { max-width: 550px; color: rgba(255,255,255,.73); line-height: 1.8; }
.light-text { color: var(--accent) !important; }
.auth-visual ul { display: grid; gap: 13px; margin: 0; padding: 0; color: rgba(255,255,255,.74); font-size: 13px; list-style: none; }
.auth-visual li::before { margin-right: 9px; color: var(--accent); content: "✓"; font-weight: 900; }
.auth-panel { display: grid; place-items: center; padding: 55px 28px; background: #f7faf9; }
.auth-card { width: min(100%, 610px); padding: clamp(28px, 4vw, 52px); border: 1px solid var(--line); border-radius: 26px; background: #fff; box-shadow: var(--shadow); }
.mobile-back { display: none; }
.step-label { margin: 0 0 8px; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: 1.5px; }
.auth-card h1 { margin: 0; font-size: clamp(28px, 3vw, 39px); letter-spacing: -1px; }
.auth-card #auth-subtitle { margin: 8px 0 28px; color: var(--muted); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 17px; }
.form-grid label, .otp-form label { display: grid; gap: 7px; }
.form-grid label > span, .otp-form label > span { font-size: 12px; font-weight: 700; }
.form-grid em { color: #d34d3f; font-style: normal; }
.form-grid label.full { grid-column: 1 / -1; }
input { width: 100%; min-height: 47px; padding: 0 13px; border: 1px solid #cadbd8; border-radius: 11px; outline: 0; color: var(--ink); background: #fbfdfc; transition: border .15s ease, box-shadow .15s ease; }
input:focus { border-color: #43a29b; box-shadow: 0 0 0 4px rgba(11,106,101,.1); background: #fff; }
input::placeholder { color: #a0afad; }
.consent { grid-template-columns: auto 1fr !important; align-items: start; gap: 9px !important; color: var(--muted); line-height: 1.5; }
.consent input { width: 17px; min-height: auto; height: 17px; margin-top: 1px; accent-color: var(--primary); }
.consent span { font-weight: 400 !important; }
.auth-switch { margin: 24px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.auth-switch a { color: var(--primary); font-weight: 800; }
.otp-form { text-align: center; }
.mail-icon { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 17px; border-radius: 20px; color: var(--primary); background: var(--soft); font-size: 26px; }
.otp-form p { margin: 0 0 5px; color: var(--muted); }
.otp-form strong { display: block; margin-bottom: 24px; }
.otp-form label { text-align: left; }
.otp-form input { height: 62px; text-align: center; font-size: 30px; font-weight: 800; letter-spacing: 12px; }
.text-button { padding: 8px; border: 0; color: var(--primary); background: transparent; font-size: 12px; font-weight: 800; cursor: pointer; }
.text-button.muted { color: var(--muted); }
.message { margin: 18px 0 0; padding: 13px 15px; border-radius: 11px; font-size: 13px; line-height: 1.55; }
.message.error { border: 1px solid #f6c7c2; color: var(--danger); background: #fff2f0; }
.message.success { border: 1px solid #bfe5d3; color: var(--success); background: #edf9f3; }
.message.info { border: 1px solid #c5dcf6; color: #175b90; background: #eff7ff; }

.company-page { display: grid; place-items: center; padding: 35px 20px; background: radial-gradient(circle at 80% 20%, rgba(212,240,138,.2), transparent 30%), linear-gradient(135deg,#eef7f5,#f8fbfa); }
.company-lookup-card { width: min(100%, 620px); padding: clamp(28px, 5vw, 55px); border: 1px solid var(--line); border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.company-result { margin-top: 45px; text-align: center; }
.company-result h1 { margin: 13px 0 8px; font-size: 38px; }
.company-result p { color: var(--muted); line-height: 1.7; }
.company-symbol { display: grid; place-items: center; width: 72px; height: 72px; margin: auto; border-radius: 22px; color: #fff; background: linear-gradient(135deg,var(--primary),#18a198); font-size: 26px; font-weight: 800; }
.spinner { width: 34px; height: 34px; margin: auto; border: 3px solid #d7e8e5; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.portal-page { display: grid; grid-template-columns: 245px 1fr; min-height: 100vh; background: #f4f8f7; }
.portal-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 28px 21px; color: #fff; background: linear-gradient(180deg,#063f3d,#075a56); }
.portal-sidebar nav { display: grid; gap: 7px; margin-top: 50px; }
.portal-sidebar nav button, .sidebar-logout { display: flex; gap: 11px; width: 100%; padding: 12px 13px; border: 0; border-radius: 10px; color: rgba(255,255,255,.7); background: transparent; text-align: left; cursor: pointer; }
.portal-sidebar nav button.active { color: #fff; background: rgba(255,255,255,.13); }
.sidebar-logout { margin-top: auto; }
.portal-content { min-width: 0; padding: 35px clamp(22px, 5vw, 65px); }
.portal-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.portal-header h1 { margin: 0; font-size: 34px; }
.portal-header .eyebrow { margin-bottom: 5px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 7px 12px 7px 7px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.user-chip > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #fff; background: var(--primary); font-weight: 800; }
.user-chip > div { display: grid; }
.user-chip small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.pending-panel { display: flex; gap: 18px; margin-top: 35px; padding: 28px; border: 1px solid #f0d891; border-radius: 18px; background: #fff9e5; }
.pending-panel > span { font-size: 30px; }
.pending-panel h2 { margin: 0 0 6px; font-size: 19px; }
.pending-panel p { margin: 0; color: var(--muted); line-height: 1.65; }
.portal-summary { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; margin-top: 34px; }
.portal-summary > div { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.portal-summary p { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.portal-summary strong { font-size: 14px; word-break: break-all; }
.portal-summary .text-button { padding: 5px 0 0; margin-left: 7px; }
.status-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: var(--success); background: #e8f7ef; font-size: 11px !important; }
.portal-section-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 42px 0 18px; }
.portal-section-title h2 { margin: 0; font-size: 25px; }
.portal-section-title p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.apps-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.portal-app { position: relative; min-height: 180px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fff; overflow: hidden; }
.portal-app.is-hidden { opacity: .48; }
.portal-app .app-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--soft); font-size: 23px; }
.portal-app h3 { margin: 17px 0 5px; }
.portal-app p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.portal-app footer { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.access-pill { padding: 4px 8px; border-radius: 999px; color: var(--primary); background: var(--soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.app-pref { display: none; font-size: 11px; }
.apps-grid.manage .app-pref { display: inline-flex; }

@media (max-width: 1050px) {
  .hero-shell { grid-template-columns: 1fr 400px; gap: 35px; padding-inline: 45px; }
  .feature-grid { grid-template-columns: repeat(3,1fr); }
  .role-flow { grid-template-columns: repeat(2,1fr); }
  .role-flow b { display: none; }
  .apps-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 800px) {
  .site-header { height: 67px; padding-inline: 18px; }
  .brand small, .nav-link, .top-nav .button.ghost { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .hero-shell { grid-template-columns: 1fr; padding: 65px 24px; text-align: center; }
  .hero-copy { margin: auto; }
  .hero-copy h1 { font-size: clamp(39px, 11vw, 58px); }
  .hero-actions, .trust-row { justify-content: center; }
  .poster-card { width: min(100%, 500px); margin: 10px auto 0; transform: none; text-align: left; }
  .section-shell { padding: 75px 20px; }
  .feature-grid { grid-template-columns: repeat(2,1fr); }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { display: block; min-height: 100vh; padding: 25px 15px; }
  .mobile-back { display: inline-block; margin: 0 0 20px 5px; color: var(--muted); font-size: 12px; text-decoration: none; }
  .auth-card { padding: 27px 21px; border-radius: 20px; }
  .portal-page { grid-template-columns: 1fr; }
  .portal-sidebar { position: static; flex-direction: row; align-items: center; height: auto; padding: 15px 18px; }
  .portal-sidebar nav { display: none; }
  .sidebar-logout { width: auto; margin: 0 0 0 auto; }
  .portal-content { padding: 24px 18px 40px; }
  .portal-summary { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .top-nav .button { padding-inline: 12px; font-size: 11px; }
  .hero-shell { min-height: auto; }
  .hero-actions { display: grid; }
  .hero-actions .button { width: 100%; }
  .trust-row { display: grid; gap: 8px; }
  .poster-card { padding: 15px; border-radius: 22px; }
  .poster-grid { gap: 8px; }
  .mini-app { min-height: 98px; padding: 12px; }
  .feature-grid, .role-flow { grid-template-columns: 1fr; }
  .feature-grid article { min-height: 185px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.full { grid-column: auto; }
  .button.full-width { grid-column: auto; }
  .site-footer { display: grid; gap: 6px; text-align: center; }
  .portal-header { align-items: flex-start; }
  .user-chip > div { display: none; }
  .portal-header h1 { font-size: 27px; }
  .apps-grid { grid-template-columns: 1fr; }
  .portal-section-title { align-items: flex-start; flex-direction: column; }
}
