:root {
    --ink: #17201d;
    --muted: #68736f;
    --line: #dce3df;
    --paper: #f7f9f7;
    --white: #ffffff;
    --forest: #16382f;
    --green: #286b55;
    --mint: #dcefe6;
    --coral: #df684f;
    --coral-soft: #f9e2dc;
    --yellow: #edc451;
    --danger: #b73c35;
    --radius: 8px;
}

* { box-sizing: border-box; }
html { font-family: "IBM Plex Sans Thai", sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; stroke-width: 1.8; flex: 0 0 auto; }
h1, h2, p { margin-top: 0; }
h1, h2, strong, .brand { letter-spacing: 0; }
h1, .brand { font-family: "Manrope", "IBM Plex Sans Thai", sans-serif; }

.profile-layout { display: grid; grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr); gap: 18px; align-items: start; }
.profile-summary, .settings-panel { border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.profile-summary { padding: 28px; }
.profile-avatar-large { width: 112px; height: 112px; margin-bottom: 24px; font-size: 44px; }
.profile-summary h2 { margin: 8px 0 2px; font-size: 26px; overflow-wrap: anywhere; }
.profile-summary > p { margin-bottom: 24px; color: var(--muted); overflow-wrap: anywhere; }
.profile-summary-meta { padding-top: 18px; display: grid; gap: 11px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.profile-summary-meta span { display: flex; align-items: center; gap: 8px; }
.profile-summary-meta svg { width: 16px; height: 16px; color: var(--green); }
.profile-panels { display: grid; gap: 18px; }
.settings-panel { padding: 26px; }
.settings-panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 24px; }
.settings-panel-heading h2 { margin: 6px 0 0; font-size: 20px; }
.settings-panel-heading > svg { color: var(--coral); }
.stack-form { display: grid; gap: 10px; }
.stack-form label { display: block; }
.stack-form label > span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.profile-form { max-width: 620px; gap: 16px; }
.settings-help { margin: -10px 0 22px; color: var(--muted); font-size: 13px; }
.field-help { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.profile-form-actions { display: flex; justify-content: flex-end; padding-top: 5px; }

@media (max-width: 900px) {
    .profile-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .profile-summary, .settings-panel { padding: 22px; }
    .profile-form-actions .button { width: 100%; }
}

.app-shell { padding-left: 260px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; padding: 28px 18px 20px; display: flex; flex-direction: column; background: var(--forest); color: white; z-index: 60; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px; font-size: 18px; font-weight: 700; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; background: var(--yellow); color: var(--forest); font-family: Manrope, sans-serif; font-weight: 800; }
.brand-mark.large { width: 48px; height: 48px; font-size: 24px; }
.main-nav { margin-top: 54px; display: grid; gap: 6px; }
.main-nav a { display: flex; align-items: center; gap: 13px; min-height: 45px; padding: 10px 12px; border-radius: 6px; color: #c9d8d3; font-weight: 500; }
.main-nav a:hover, .main-nav a.active { color: white; background: #285044; }
.main-nav a.active::before { content: ""; width: 3px; height: 22px; margin-left: -12px; background: var(--yellow); }
.account-block { margin-top: auto; display: grid; grid-template-columns: 38px 1fr 36px; gap: 10px; align-items: center; padding-top: 18px; border-top: 1px solid #31574c; }
.account-block img, .avatar-fallback { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--mint); color: var(--forest); font-weight: 700; }
.account-block strong, .account-block small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-block strong { font-size: 13px; }.account-block small { color: #9eb5ad; font-size: 11px; }
.account-block .icon-button { color: #c9d8d3; }
.mobile-header, .sidebar-scrim { display: none; }
.main-content { max-width: 1440px; min-height: 100vh; padding: 52px clamp(28px, 5vw, 76px) 70px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.page-header.compact { margin-bottom: 28px; }
.page-header h1 { margin: 4px 0 4px; font-size: clamp(30px, 4vw, 43px); line-height: 1.15; }
.page-header p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--coral); font-family: Manrope, sans-serif; font-size: 11px; font-weight: 700; letter-spacing: 0; }
.button { min-height: 42px; padding: 9px 16px; border: 1px solid transparent; border-radius: 6px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.button.primary { color: white; background: var(--green); }.button.primary:hover { background: #205a47; }
.button.secondary { border-color: var(--line); background: white; }.button.secondary:hover { background: #f1f4f2; }
.button.danger { color: white; background: var(--danger); }.button.danger-outline { color: var(--danger); border-color: #e3b7b3; background: white; }
.icon-button { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border: 0; border-radius: 6px; color: inherit; background: transparent; cursor: pointer; }
.icon-button:hover { background: rgba(127, 127, 127, .12); }

.stats-band { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: white; overflow: hidden; }
.stat-item { min-height: 164px; padding: 26px 28px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.stat-item:last-child { border: 0; }.stat-item.accent { background: var(--mint); }
.stat-item span, .stat-item small { color: var(--muted); }.stat-item strong { margin: 12px 0 4px; font-family: Manrope, sans-serif; font-size: 40px; }.stat-item strong.date-value { font-family: "IBM Plex Sans Thai", sans-serif; font-size: 24px; }
.quick-section, .history-section { margin-top: 46px; }.section-heading { display: flex; justify-content: space-between; margin-bottom: 16px; }.section-heading h2 { margin-bottom: 2px; font-size: 20px; }.section-heading p { color: var(--muted); font-size: 14px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }.quick-grid > a { min-height: 94px; padding: 18px; display: grid; grid-template-columns: 48px 1fr 24px; align-items: center; gap: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }.quick-grid > a:hover { border-color: #98aaa3; }.quick-grid strong, .quick-grid small { display: block; }.quick-grid small { margin-top: 3px; color: var(--muted); }.quick-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 7px; }.quick-icon.green { background: var(--mint); color: var(--green); }.quick-icon.coral { background: var(--coral-soft); color: var(--coral); }

.search-bar { position: relative; display: flex; align-items: center; margin-bottom: 18px; }.search-bar > svg { position: absolute; left: 15px; color: var(--muted); }.search-bar input { width: 100%; height: 48px; padding: 0 50px 0 47px; border: 1px solid var(--line); border-radius: 7px; background: white; outline: none; }.search-bar input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40,107,85,.1); }.search-bar .icon-button { position: absolute; right: 7px; }
.directory-table { border: 1px solid var(--line); border-radius: var(--radius); background: white; overflow: hidden; }.table-row { min-height: 72px; padding: 10px 16px; display: grid; grid-template-columns: minmax(180px,1.3fr) minmax(180px,1.2fr) 1fr 100px 24px; gap: 18px; align-items: center; border-bottom: 1px solid var(--line); }.table-row:last-child { border: 0; }.table-row:not(.table-head):hover { background: #f5f8f6; }.table-head { min-height: 42px; color: var(--muted); background: #f1f4f2; font-size: 12px; font-weight: 600; }.person-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }.person-cell img, .person-cell b { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; color: var(--green); background: var(--mint); }.person-cell strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.contact-cell b, .contact-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.contact-cell small { color: var(--muted); }.source-pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-style: normal; font-weight: 600; }.source-pill.google { color: #2b5ca7; background: #e4edfa; }.source-pill.manual { color: #8a4b24; background: #faeadc; }.pagination { margin-top: 20px; display: flex; gap: 6px; justify-content: center; }.pagination a { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; }.pagination a.active { color: white; background: var(--green); }
.empty-state { padding: 70px 20px; text-align: center; color: var(--muted); }.empty-state > svg { width: 42px; height: 42px; }.empty-state h2 { margin: 12px 0 4px; color: var(--ink); }.empty-state.small { padding: 36px 20px; }
.person-cell span strong, .person-cell span small { display: block; }.person-cell span small { color: var(--muted); font-size: 12px; }.compact-select { width: 120px; height: 36px; }.status-pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-style: normal; font-weight: 600; }.status-pill.active { color: #1d6a48; background: #dcefe6; }.status-pill.inactive { color: #8c3933; background: #f7dfdc; }

.back-link { display: inline-flex; gap: 7px; align-items: center; margin-bottom: 12px; color: var(--muted); font-size: 14px; }.back-link:hover { color: var(--green); }.contact-form { max-width: 920px; }.form-section { padding: 28px 0 34px; display: grid; grid-template-columns: 190px 1fr; gap: 34px; border-top: 1px solid var(--line); }.form-section-title { display: flex; gap: 12px; }.form-section-title > span { color: var(--coral); font: 700 11px Manrope, sans-serif; }.form-section-title h2 { margin-bottom: 2px; font-size: 17px; }.form-section-title p { color: var(--muted); font-size: 12px; }.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }.form-grid .full { grid-column: 1 / -1; }label > span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }input, select, textarea { width: 100%; border: 1px solid #cfd8d3; border-radius: 6px; background: white; color: var(--ink); outline: none; }input, select { height: 43px; padding: 0 12px; }textarea { padding: 12px; resize: vertical; }input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40,107,85,.1); }.repeat-group + .repeat-group { margin-top: 25px; }.repeat-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }.text-button { padding: 5px; display: inline-flex; align-items: center; gap: 5px; border: 0; color: var(--green); background: transparent; cursor: pointer; font-weight: 600; }.repeat-row { display: grid; grid-template-columns: 120px 1fr 38px; gap: 8px; margin-bottom: 8px; }.repeat-row .icon-button { color: var(--danger); }.form-actions { position: sticky; bottom: 0; padding: 16px 0; display: flex; justify-content: flex-end; gap: 10px; background: rgba(247,249,247,.94); backdrop-filter: blur(8px); z-index: 10; }

.detail-header { align-items: center; }.header-actions { display: flex; gap: 8px; }.profile-hero { min-height: 165px; padding: 28px; display: flex; gap: 24px; align-items: center; border-radius: var(--radius); color: white; background: var(--forest); }.profile-avatar { width: 92px; height: 92px; flex: 0 0 92px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); color: var(--forest); font: 700 36px Manrope, sans-serif; overflow: hidden; }.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }.profile-hero h1 { margin: 9px 0 2px; font-size: 32px; }.profile-hero p { margin: 0; color: #b9cbc5; }.detail-columns { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }.detail-section { min-height: 170px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }.detail-section h2 { display: flex; gap: 9px; align-items: center; padding-bottom: 13px; border-bottom: 1px solid var(--line); font-size: 16px; }.detail-row { min-height: 38px; display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 12px; }.detail-row span, .muted { color: var(--muted); font-size: 13px; }.detail-row a { color: var(--green); }.notes-copy { color: #44504c; line-height: 1.7; }

.import-band { min-height: 150px; padding: 28px; display: grid; grid-template-columns: 68px 1fr auto; align-items: center; gap: 22px; border-radius: var(--radius); color: white; background: var(--forest); }.import-band h2 { margin-bottom: 4px; }.import-band p { max-width: 620px; margin: 0; color: #b9cbc5; }.import-symbol { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 7px; color: var(--forest); background: var(--yellow); }.import-symbol svg { width: 30px; height: 30px; }.history-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: white; }.history-row { min-height: 67px; padding: 12px 18px; display: grid; grid-template-columns: 12px 1fr 130px 130px; gap: 14px; align-items: center; border-bottom: 1px solid var(--line); }.history-row:last-child { border: 0; }.history-row strong, .history-row small { display: block; }.history-row small, .history-row > span { color: var(--muted); font-size: 12px; }.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #999; }.status-dot.completed { background: #37a270; }.status-dot.failed { background: var(--danger); }.status-dot.running { background: var(--yellow); }

.toast { position: fixed; top: 20px; right: 22px; max-width: min(420px, calc(100vw - 32px)); padding: 13px 16px; display: flex; align-items: center; gap: 9px; border-radius: 7px; color: white; box-shadow: 0 14px 38px rgba(12,30,24,.18); z-index: 300; animation: toast-in .25s ease both; }.toast.success { background: var(--green); }.toast.error { background: var(--danger); }.toast.leaving { opacity: 0; transform: translateY(-8px); transition: .25s; pointer-events: none; }@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
.confirm-dialog { max-width: 420px; padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 24px 70px rgba(0,0,0,.28); z-index: 500; }.confirm-dialog::backdrop { background: rgba(12,25,21,.62); }.dialog-panel { padding: 28px; text-align: center; }.dialog-icon { width: 50px; height: 50px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 50%; color: var(--danger); background: #f9e2df; }.dialog-panel h2 { margin-bottom: 7px; }.dialog-panel p { color: var(--muted); }.dialog-actions { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.error-page { min-height: 70vh; display: grid; place-content: center; justify-items: center; text-align: center; }.error-page > strong { color: var(--coral); font: 700 72px Manrope, sans-serif; }.error-page h1 { margin-bottom: 5px; }.error-page p { color: var(--muted); }

.guest-shell { background: white; }.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }.login-identity { position: relative; padding: clamp(40px,8vw,110px); display: flex; flex-direction: column; justify-content: center; overflow: hidden; color: white; background-color: var(--forest); background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 48px 48px; }.login-identity h1 { max-width: 700px; margin: 12px 0; font-size: clamp(54px,8vw,112px); line-height: .96; }.login-identity > p { max-width: 540px; color: #c3d3ce; font-size: 19px; }.identity-grid { position: absolute; right: 7%; bottom: 8%; display: grid; grid-template-columns: repeat(3, 20px); gap: 8px; }.identity-grid span { width: 20px; height: 20px; background: var(--yellow); }.identity-grid span:nth-child(2), .identity-grid span:nth-child(4) { background: var(--coral); }.login-action { display: grid; place-items: center; padding: 35px; }.login-panel { width: min(380px, 100%); }.login-panel h2 { margin: 25px 0 4px; font-size: 28px; }.login-panel p { margin-bottom: 28px; color: var(--muted); }.google-button { width: 100%; min-height: 50px; border-color: var(--line); background: white; box-shadow: 0 5px 18px rgba(20,40,33,.08); }.google-button:hover { border-color: #a7b5b0; }.google-button svg { stroke: none; }

@media (max-width: 900px) {
    .app-shell { padding: 68px 0 0; }.mobile-header { position: fixed; inset: 0 0 auto; height: 68px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; color: white; background: var(--forest); z-index: 55; }.mobile-header .brand { padding: 0; }.sidebar { transform: translateX(-100%); transition: transform .22s ease; }.sidebar-open .sidebar { transform: translateX(0); }.sidebar-scrim { position: fixed; inset: 0; display: block; visibility: hidden; opacity: 0; background: rgba(9,22,18,.55); z-index: 58; transition: .2s; }.sidebar-open .sidebar-scrim { visibility: visible; opacity: 1; }.main-content { padding: 34px 22px 60px; }.stats-band { grid-template-columns: 1fr; }.stat-item { min-height: 130px; border-right: 0; border-bottom: 1px solid var(--line); }.quick-grid { grid-template-columns: 1fr; }.table-head { display: none; }.table-row { grid-template-columns: minmax(150px,1fr) 1fr 24px; }.table-row > span:nth-child(3), .table-row > span:nth-child(4) { display: none; }.form-section { grid-template-columns: 1fr; gap: 14px; }.login-page { grid-template-columns: 1fr; }.login-identity { min-height: 42vh; padding: 50px 30px; }.login-identity h1 { font-size: clamp(48px,15vw,76px); }.login-action { min-height: 58vh; }.detail-columns { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .main-content { padding: 27px 15px 50px; }.page-header { align-items: flex-start; }.page-header:not(.detail-header) { flex-direction: column; }.page-header .button { width: 100%; }.page-header h1 { font-size: 32px; }.table-row { padding: 11px; grid-template-columns: 1fr 22px; gap: 8px; }.table-row > .contact-cell { display: none; }.form-grid { grid-template-columns: 1fr; }.form-grid .full { grid-column: auto; }.repeat-row { grid-template-columns: 95px 1fr 36px; }.detail-header { flex-wrap: wrap; }.header-actions { width: 100%; }.header-actions .button { flex: 1; }.profile-hero { align-items: flex-start; padding: 22px; }.profile-avatar { width: 66px; height: 66px; flex-basis: 66px; font-size: 27px; }.profile-hero h1 { font-size: 24px; overflow-wrap: anywhere; }.import-band { grid-template-columns: 52px 1fr; padding: 21px; }.import-symbol { width: 50px; height: 50px; }.import-band form { grid-column: 1 / -1; }.import-band .button { width: 100%; }.history-row { grid-template-columns: 10px 1fr; }.history-row > span:not(.status-dot) { display: none; }.login-identity { min-height: 36vh; }.login-action { min-height: 64vh; padding: 28px; }
}