*{box-sizing:border-box}body{margin:0;color:#173839;background:#f2f5f2;font:16px/1.5 system-ui,-apple-system,sans-serif}header{background:#122a2c;color:#fff}.outer{width:min(760px,calc(100% - 32px));margin:auto}.top{display:flex;gap:12px;justify-content:space-between;align-items:center;padding:17px 0;border-bottom:1px solid #ffffff22}.brand,.eyebrow{color:#e1eda3;font-size:.75rem;font-weight:800;letter-spacing:.12em}.hero{padding:23px 0 27px}.hero p{color:#d8e5de;max-width:560px;margin-bottom:0}h1,h2,h3,p{margin-top:0}h1{font-size:clamp(1.85rem,6.2vw,2.8rem);line-height:1.18;margin:8px 0 10px}h2{font-size:1.23rem;margin-bottom:0}h3{font-size:1rem;margin:0}.panel,.notice{background:#fff;border:1px solid #d7e3da;border-radius:17px;padding:17px;margin:15px 0}.notice{background:#eaf1e4}.notice p,.muted{margin:0 0 12px;color:#456360}.sectionhead{display:flex;justify-content:space-between;gap:8px;align-items:baseline;margin:0 0 13px}.sectionhead span{font-size:.8rem;color:#456360}.fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}label{display:grid;gap:5px;min-width:0;font-size:.93rem;font-weight:650}input,textarea,select{width:100%;min-width:0;padding:10px;border:1px solid #a9bdb1;border-radius:8px;font:16px system-ui;background:white;color:#173839}input[type=date]{min-height:44px}textarea{resize:vertical;min-height:70px}details{border:1px solid #d7e3da;border-radius:12px;margin:8px 0}summary{padding:13px;cursor:pointer;font-weight:750;min-height:48px}.cardbody{padding:0 13px 12px;display:grid;gap:10px}.photo{margin:0 0 14px}.photo img{max-width:100%;width:100%;max-height:195px;object-fit:contain;border-radius:9px;background:#eff4ee;margin-top:7px}.photo img:not([src]),[hidden]{display:none!important}.photoControls{display:flex;gap:8px;align-items:center}.photoControls label{flex:1}.photoControls button{align-self:end}.language{display:flex;gap:4px}.language button{color:white;background:transparent;padding:5px 9px;border-color:#5a7975;white-space:nowrap}.language button[aria-pressed=true]{background:#e1eda3;color:#122a2c;border-color:#e1eda3}button,.result a{font:inherit;font-weight:700;cursor:pointer;text-decoration:none;border:1px solid transparent;border-radius:9px;display:inline-flex;justify-content:center;align-items:center;min-height:43px;padding:8px 12px}button:disabled{opacity:.6;cursor:wait}.primary,.result a{background:#006459;color:#fff}.primary{width:100%;margin-top:8px}.secondary{background:white;color:#005a50;border-color:#9cb7a7}.export p{margin-top:6px}.result{display:flex;flex-wrap:wrap;gap:7px}.result p{width:100%;color:#456360;font-size:.88rem}#status:empty{display:none}footer{font-size:.84rem;color:#456360;margin:18px 0 28px}@media(max-width:425px){.outer{width:calc(100% - 24px)}.panel,.notice{padding:13px}.fields{gap:9px}.fields label:nth-child(-n+2){grid-column:1/-1}.top{padding:12px 0}}
@font-face{font-family:AppThai;src:url(thai-regular.ttf) format("truetype");font-weight:400 600;font-display:swap}
@font-face{font-family:AppThai;src:url(thai-bold.ttf) format("truetype");font-weight:650 900;font-display:swap}
:root{color-scheme:light;--ink:#182522;--accent:#254b40;--line:#dce3de;--muted:#52645c}
body{background:#f7f8f6;color:var(--ink);font-family:AppThai,system-ui,-apple-system,sans-serif}
header{background:#fff;color:var(--ink);border-bottom:1px solid var(--line)}
.top{padding:15px 0;border-bottom:1px solid #e8ece9}
.brand,.eyebrow{color:var(--accent);font-weight:700;letter-spacing:.08em}
.eyebrow:lang(th){letter-spacing:0}
.hero{padding:28px 0 26px}
h1{font-family:inherit;font-size:clamp(1.9rem,6.8vw,3rem);font-weight:700;line-height:1.3;letter-spacing:-.028em;margin:5px 0 4px}
h1:lang(th){letter-spacing:0}
.hero p,.notice p,.muted,.sectionhead span,footer{color:var(--muted)}
.language button{color:var(--accent);border-color:transparent;background:#f6f7f5;min-height:36px}.language button[aria-pressed=true]{background:#e5ece7;color:var(--accent);border-color:#dce6df}
.panel,.notice{border-color:var(--line);border-radius:13px}
.notice{background:#f1f4f0}
.category-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;margin:0 0 12px}
.category-nav button{min-width:0;padding:5px 2px;font:.83rem AppThai,system-ui,sans-serif;font-weight:700;color:var(--accent);background:#f6f8f6;border:1px solid var(--line);min-height:42px;overflow-wrap:anywhere}
.category-nav button[aria-pressed=true]{color:white;background:var(--accent);border-color:var(--accent)}
.primary,.result a{background:var(--accent)}
input,textarea,select{font-family:AppThai,system-ui,-apple-system,sans-serif;border-color:#bac9c0}
details{border-color:var(--line)}
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible{outline:2px solid #30755e;outline-offset:2px}
@media(max-width:425px){.hero{padding:21px 0 20px}.category-nav button{font-size:.78rem}}

/* Keep Safari's intrinsic date control inside the same grid box as text inputs. */
#cover-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
#cover-fields > label{grid-template-columns:minmax(0,1fr)}
#cover-fields input{
  display:block;box-sizing:border-box;inline-size:100%;min-inline-size:0;max-inline-size:100%;
  block-size:44px;min-block-size:44px;max-block-size:44px;
  padding:0 10px;font-size:16px;line-height:normal
}
#cover-fields input[type="date"]{-webkit-appearance:none;appearance:none;color:var(--ink);text-align:start}
#cover-fields input[type="date"]::-webkit-date-and-time-value{min-width:0;text-align:start;margin:0}
#cover-fields input[type="date"]::-webkit-datetime-edit{min-width:0;padding:0}
.cardbody .fields > label{grid-column:auto}
.cardbody .fields{grid-template-columns:repeat(2,minmax(0,1fr))}
.cardbody .fields > label{grid-template-columns:minmax(0,1fr)}
.cardbody .fields select,.cardbody .fields input{height:44px;min-width:0;padding:0 8px}

#projects{margin-bottom:1rem}
#projects .project-actions{display:flex;flex-wrap:wrap;gap:.45rem;align-items:center}
#projects ul{padding:0;margin:.65rem 0 0;list-style:none}
#projects li{display:flex;align-items:center;justify-content:space-between;gap:.65rem;flex-wrap:wrap;border-top:1px solid #d4dcd8;padding:.65rem 0}
#projects li strong{overflow-wrap:anywhere}
#projects .project-meta,#project-current,#project-status{font-size:.9rem}
#projects .project-meta{color:#52655f}
#projects button{min-height:44px}
#project-status:empty{display:none}
.export .project-actions{display:flex;flex-wrap:wrap;gap:.55rem}
#project-status-bottom:empty{display:none}

.project-note-link{border:0;background:none;color:#52655f;text-decoration:underline;text-underline-offset:.16em;padding:.25rem 0;font-size:.83rem}
#project-storage-note{box-sizing:border-box;width:min(26rem,calc(100% - 2rem));max-height:calc(100% - 2rem);padding:1.15rem;border:1px solid #71847a;border-radius:15px;color:#182520;background:#fff;box-shadow:0 10px 32px rgba(25,45,34,.15)}
#project-storage-note:not([open]){display:none}
#project-storage-note::backdrop{background:rgba(10,24,18,.22)}
#project-storage-note h2{font-size:1.04rem;margin:0 0 .65rem}
#project-storage-note p{font-size:.88rem;line-height:1.5;margin:.45rem 0}
#project-storage-note .project-note-check{display:flex;gap:.5rem;align-items:center;min-height:44px;margin:.55rem 0;font-size:.9rem}
#project-storage-note .project-note-check[hidden]{display:none}
#project-storage-note input[type=checkbox]{height:1.05rem;width:1.05rem;padding:0;margin:0;flex:none;accent-color:#254a3f}
#project-transfer{margin-top:.75rem;border-top:1px solid #d4dcd8}
#project-transfer summary{font-size:.9rem}
#project-transfer p{font-size:.88rem}
#transfer-status:empty{display:none}
#cloud-projects{margin-top:.75rem;border-top:1px solid #d4dcd8}
#cloud-projects summary,#cloud-projects p{font-size:.88rem}
#cloud-status:empty{display:none}

.theme-setting{display:flex;align-items:center;gap:.5rem;justify-content:flex-end;float:right;margin:0 0 .3rem .7rem;font-size:.78rem;color:var(--muted)}
.theme-setting select{width:auto;min-height:44px;padding:.35rem .6rem;font-size:16px}
.hero h1{clear:both}
#status.error{color:#9d3629}
:root[data-theme=dark]{color-scheme:dark;--ink:#f0f0f0;--accent:#c1dfcf;--line:#383838;--muted:#bcbcbc;--dark-bg:#000;--dark-panel:#151515;--dark-input:#1c1c1c;--dark-btn:#a8d1ba;--dark-btn-ink:#101410}
[data-theme=dark] body{background:var(--dark-bg);color:var(--ink)}
[data-theme=dark] header,[data-theme=dark] .panel,[data-theme=dark] #project-storage-note{background:var(--dark-panel);color:var(--ink);border-color:var(--line)}
[data-theme=dark] .notice{background:#191919;border-color:var(--line)}
[data-theme=dark] .top,[data-theme=dark] #projects li,[data-theme=dark] #project-transfer,[data-theme=dark] #cloud-projects{border-color:var(--line)}
[data-theme=dark] .category-nav button,[data-theme=dark] .language button,[data-theme=dark] .secondary,[data-theme=dark] input,[data-theme=dark] textarea,[data-theme=dark] select{color:var(--ink);background:var(--dark-input);border-color:#737373}
[data-theme=dark] .category-nav button[aria-pressed=true],[data-theme=dark] .language button[aria-pressed=true],[data-theme=dark] .primary,[data-theme=dark] .result a{background:var(--dark-btn);color:var(--dark-btn-ink);border-color:var(--dark-btn)}
[data-theme=dark] .photo img{background:#191919}
[data-theme=dark] #projects .project-meta,[data-theme=dark] .project-note-link,[data-theme=dark] .result p{color:var(--muted)}
[data-theme=dark] #status.error,[data-theme=dark] .photo p[role=status]{color:#ffc3b6}
[data-theme=dark] button:focus-visible,[data-theme=dark] a:focus-visible,[data-theme=dark] input:focus-visible,[data-theme=dark] textarea:focus-visible,[data-theme=dark] select:focus-visible,[data-theme=dark] summary:focus-visible{outline-color:#a8d1ba}

#cards{touch-action:pan-y pinch-zoom}

/* Shared settings panel, tuned for single-hand use on mobile. */
.settings-icon{display:grid;place-items:center;width:44px;height:44px;min-height:44px;padding:0;border:1px solid var(--line);border-radius:50%;background:#f3f6f2;color:var(--accent);flex-shrink:0}
.settings-icon:hover{filter:brightness(.96)}
.settings-icon span{font:400 1.6rem/1 system-ui,sans-serif}
#settings-dialog{width:min(calc(100vw - 26px),460px);max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px);overflow:auto;overscroll-behavior:contain;padding:16px 19px 20px;border:1px solid var(--line);border-radius:22px;background:white;color:var(--ink);box-shadow:0 22px 70px #172c2633}
#settings-dialog::backdrop{background:rgba(20,22,21,.30);-webkit-backdrop-filter:blur(7px);backdrop-filter:blur(7px)}
[data-theme=dark] #settings-dialog::backdrop{background:rgba(0,0,0,.52)}
[data-theme=dark] header{background:#000}
#settings-title:focus{outline:none}
.settings-heading{display:grid;grid-template-columns:44px 1fr 44px;align-items:center;gap:8px;margin-bottom:12px}
#settings-title{grid-column:2;text-align:center;margin:0}
#settings-close{grid-column:3;grid-row:1}
#settings-back{grid-column:1;grid-row:1}
.setting-row,.profile-row{display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px;border:0;border-bottom:1px solid var(--line);background:none;color:var(--ink);min-height:57px;padding:9px 0;text-align:left}
.setting-row:last-child{border-bottom:0}
#settings-account-open{font-size:1rem;border-radius:0}
#settings-account-open span:last-child{font:1.6rem/1 system-ui}
.setting-row .theme-setting{display:flex;align-items:center;justify-content:space-between;flex:1;float:none;margin:0;text-align:left;font:inherit}
.setting-row select{width:auto;min-height:42px}
.text-action{background:none;color:var(--accent);padding:5px 0;font:inherit;text-decoration:underline;text-underline-offset:4px}
.profile-row>span:first-child{font-weight:700}
.profile-row input{width:52%;text-align:right}
#profile-email{min-width:0;overflow-wrap:anywhere;text-align:right;color:var(--muted)}
.profile-hint,#profile-status{font-size:.86rem;margin:12px 0 4px;color:var(--muted)}
#profile-status:empty{display:none}
#profile-logout{display:block;margin:10px auto 0;color:#9b2f34}
[data-theme=dark] .settings-icon,[data-theme=dark] #settings-dialog{background:var(--dark-panel);color:var(--ink)}
[data-theme=dark] #profile-logout{color:#ffb6b4}

#profile-password{min-width:0;text-align:right;color:var(--muted)}

/* The profile header reflects only the last saved values. */
.header-profile{display:flex;align-items:center;gap:10px;min-width:0;flex:1}
.header-profile-avatar,.profile-picture{display:grid;place-items:center;flex-shrink:0;overflow:hidden;border-radius:50%;color:var(--accent);background:#eef3ef;border:1px solid var(--line)}
.header-profile-avatar{width:40px;height:40px}
.header-profile-avatar span,.profile-picture span{display:grid;place-items:center}
.header-profile-avatar img,.profile-picture img{width:100%;height:100%;object-fit:contain;background:#fff}
.header-profile-name{font-weight:730;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile-upload{display:flex;align-items:center;justify-content:flex-start;gap:14px;margin:12px 0 18px}
.profile-picture{width:66px;height:66px}
.profile-upload-actions{display:flex;flex-wrap:wrap;gap:2px 14px;min-width:0}
#profile-upload-open{min-height:40px;font-size:.88rem;text-align:left}
#profile-save{margin-top:15px}
[data-theme=dark] .header-profile-avatar,[data-theme=dark] .profile-picture{background:var(--dark-input)}

/* Compact app heading with a stable, single-line animated keyword area. */
.hero{padding:13px 0 12px}
.hero h1{font-size:clamp(1.22rem,4.9vw,1.65rem);line-height:1.24;margin:0 0 3px}
.hero-keyword-line{height:1.55rem;display:flex;align-items:center;font-weight:650;font-size:.86rem;color:var(--accent);overflow:hidden}
.hero-keyword-pop{animation:inspector-keyword-in .3s ease-out}
@keyframes inspector-keyword-in{from{opacity:.08;transform:translateY(.28rem)}to{opacity:1;transform:translateY(0)}}
.sr-inspector{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
@media(prefers-reduced-motion:reduce){.hero-keyword-pop{animation:none}}

/* One compact row instead of a tall sample-data card. */
.sample-strip{display:flex;align-items:flex-start;flex-wrap:wrap;gap:0 9px;margin:9px 0 11px}
.sample-button{min-height:44px;font-size:.86rem;gap:7px;padding:6px 11px;border-radius:999px}
.sample-button svg{flex-shrink:0}
.sample-details{display:contents}
.sample-details summary{display:inline-flex;align-items:center;gap:4px;min-height:44px;padding:5px 2px;margin:0;font-size:.81rem;font-weight:500;color:var(--muted);list-style:none}
.sample-details summary::-webkit-details-marker{display:none}
.sample-details summary::after{content:'';width:5px;height:5px;border:solid currentColor;border-width:0 1px 1px 0;transform:rotate(45deg);margin-left:3px}
.sample-details[open] summary::after{transform:rotate(225deg)}
.sample-detail-text{width:100%;border-top:1px solid var(--line);margin-top:6px;padding:8px 2px 0;color:var(--muted);font-size:.82rem}
.sample-detail-text p{margin:0 0 6px}
