/* ict2-oneui.css — เลเยอร์รูปทรง/พื้นผิวแบบ Samsung One UI 9 (โหลดหลังสุดในทุกหน้า)
   หลักการ: พื้นหลังเรียบ + การ์ดทึบมุมโค้งใหญ่ ไม่มีเส้นขอบ/กระจกเบลอ, ปุ่มและชิปทรงเม็ดยา,
   หัวเรื่องหน้าใหญ่, แถบนำทางล่างแบบ pill indicator, bottom sheet มีที่จับ
   สีอ้างอิงโทเคนใน ict2-theme.css (โทนน้ำเงินเดิม) — ห้ามใส่สีตายตัวที่นี่ */

html{-webkit-text-size-adjust:100%;scroll-behavior:smooth;}
body{background:var(--c-bg);min-height:100vh;min-height:100dvh;font-size:var(--fs-base);line-height:1.55;overflow-wrap:anywhere;}
body{overflow-wrap:break-word;}
button,input,select,textarea{font-family:inherit;}
::selection{background:var(--c-primary-ring);}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;}}

/* ── Login ── */
.aurora{display:none;}
.login-wrap{min-height:100vh;min-height:100dvh;background:radial-gradient(900px 420px at 50% -120px,var(--c-primary-soft),transparent 70%),var(--c-bg);padding:16px;}
.login-card{max-width:420px;background:var(--c-card);border:0;border-radius:36px;box-shadow:0 1px 2px rgba(20,58,110,.05),0 12px 36px rgba(20,58,110,.08);padding:44px 28px 30px;}
[data-theme="dark"] .login-card{box-shadow:none;}
.login-badge{width:84px;height:84px;border-radius:50%;background:linear-gradient(145deg,var(--c-primary),var(--c-primary-deep));background:linear-gradient(145deg,#2f74da,#123a73);box-shadow:0 10px 24px rgba(18,58,115,.28);}
.login-badge svg{width:38px;height:38px;}
.login-title{font-size:28px;}
.btn-google{min-height:56px;border-radius:999px;background:var(--c-primary-fill);color:var(--c-on-primary);box-shadow:none;font-size:16px;}
.btn-google:hover{background:var(--c-primary-fill-hover);transform:none;box-shadow:none;}
.btn-google:focus-visible{outline-offset:3px;}
.domain-chip{background:var(--c-primary-soft)!important;border:0!important;}
.login-footnote{opacity:1;}

/* ── Buttons / controls ── */
.btn{min-height:48px;padding:10px 24px;border-radius:999px;border:0;font-size:15px;}
.btn-primary,[data-theme="dark"] .btn-primary{background:var(--c-primary-fill);color:var(--c-on-primary);}
.btn-primary:hover,[data-theme="dark"] .btn-primary:hover{background:var(--c-primary-fill-hover);}
.btn-ghost{background:var(--c-surface-soft);color:var(--c-ink);border:0;}
.btn-ghost:hover{background:var(--c-primary-soft);color:var(--c-primary-deep);border:0;}
.btn-danger{background:var(--c-coral-soft);color:var(--c-coral);}
.btn-danger:hover{background:var(--c-coral-soft);filter:brightness(.96);border:0;}
.btn:disabled{opacity:.55;cursor:not-allowed;}
.btn svg{width:18px;height:18px;}
.theme-toggle,.icon-btn{border-radius:50%;}
.theme-toggle{width:44px;height:44px;border:0;background:var(--c-surface-soft);box-shadow:none;}
.theme-toggle:hover{background:var(--c-primary-soft);}
.theme-toggle svg{width:20px;height:20px;}
.icon-btn,.equip-icon-btn{width:44px;height:44px;border-radius:50%;}
.equip-icon-btn svg,.icon-btn svg{width:18px;height:18px;}
.pg-btn{width:44px;height:44px;border-radius:50%;border:0;background:var(--c-surface-soft);box-shadow:none;}
.pg-btn:hover:not(:disabled){background:var(--c-primary-soft);}
.btn-logout{border-radius:999px;border:0;background:var(--c-surface-soft);box-shadow:none;min-height:46px;}
.btn-logout:hover{background:var(--c-coral-soft);color:var(--c-coral);}
.btn-import{border-radius:999px;background:var(--c-surface-soft)!important;border:0!important;min-height:44px;}

/* ── Forms ── */
.form-label{font-size:13px;margin-bottom:6px;padding-left:4px;}
.form-input,.form-select,.form-textarea{min-height:52px;padding:12px 18px;border:1.5px solid transparent;border-radius:var(--radius-sm);background:var(--c-surface-soft);font-size:15px;}
.form-textarea{min-height:96px;padding:14px 18px;}
.form-input::placeholder,.form-textarea::placeholder{color:var(--c-ink-soft);opacity:.75;}
.form-input:focus,.form-select:focus,.form-textarea:focus{border-color:var(--c-primary);background:var(--c-card);box-shadow:0 0 0 3px var(--c-primary-ring);}
.form-input[readonly]{background:transparent;border-color:var(--c-line);color:var(--c-ink-soft);}
.form-input:disabled,.form-select:disabled{opacity:.6;cursor:not-allowed;}
.form-select{background-image:var(--select-arrow);background-repeat:no-repeat;background-position:right 16px center;padding-right:42px;text-overflow:ellipsis;}
.form-select option{background:var(--c-card);color:var(--c-ink);}
.clear-wrap .form-select{padding-right:64px;}
.clear-wrap .form-select+.clear-btn{right:38px;}
.clear-btn{width:28px;height:28px;right:10px;}
.form-field.has-error .form-input,.form-field.has-error .form-select{border-color:var(--c-coral);background:var(--c-coral-soft);}
.form-error{font-size:12.5px;padding-left:4px;}
.form-actions{border-top:1px solid var(--c-line);gap:10px;}
.search-wrap .form-input{padding-left:46px;border-radius:999px;}
.search-wrap svg{left:18px;width:18px;height:18px;}
.photo-drop{border:2px dashed var(--c-border);border-radius:var(--r-tile);background:transparent;}
.photo-drop:hover{background:var(--c-primary-soft);border-color:var(--c-primary);}
.photo-preview-item img{border-radius:16px;}
.photo-preview-remove{border-color:var(--c-card);}
.tm-check input,input[type=checkbox],input[type=radio]{accent-color:var(--c-primary-fill);}

/* ── Chips / badges ── */
.chip-filter{min-height:40px;padding:6px 16px;border:0;background:var(--c-surface-soft);color:var(--c-ink-soft);}
.chip-filter:hover{background:var(--c-primary-soft);color:var(--c-ink);}
.chip-filter.active,[data-theme="dark"] .chip-filter.active{background:var(--c-primary-fill);color:var(--c-on-primary);}
.chip-filter.active .chip-count{background:rgba(0,0,0,.24);color:#fff;}
.status-badge{font-size:13px;padding:4px 12px;}
.tm-mini{border:0;background:var(--c-surface-soft);min-height:38px;}
.tm-mini.active{background:var(--c-primary-soft);box-shadow:inset 0 0 0 1.5px var(--c-primary);}
.seg-toggle{background:var(--c-surface-soft);padding:4px;}
.seg-toggle-btn{min-height:40px;font-size:13.5px;}
.seg-toggle-btn.active{background:var(--c-card);box-shadow:0 1px 3px rgba(20,58,110,.14);}
.tag,.equip-tag,.asset-pill{border:0;}

/* ── Cards / lists ── */
.card{background:var(--c-card);backdrop-filter:none;-webkit-backdrop-filter:none;border:0;border-radius:var(--radius-card);padding:24px;box-shadow:var(--shadow-card);margin-bottom:16px;}
.card-title{font-size:17px;}
.ticket-card,.equip-card,.supply-card{background:var(--c-card);backdrop-filter:none;-webkit-backdrop-filter:none;border:0;border-radius:24px;box-shadow:var(--shadow-card);transition:background .15s,transform .15s;}
.ticket-card{padding:18px 20px;}
.ticket-card:hover,.equip-card:hover,.supply-card:hover{background:var(--c-card);box-shadow:0 0 0 2px var(--c-primary-ring);transform:none;border:0;}
.equip-card.pending-review,.supply-card.low-stock{box-shadow:0 0 0 1.5px var(--c-warning);}
.supply-card.out-of-stock{box-shadow:0 0 0 1.5px var(--c-coral);}
.ticket-reporter{border-top:1px solid var(--c-line);}
.state-empty{background:var(--c-card);backdrop-filter:none;-webkit-backdrop-filter:none;border:0;border-radius:var(--radius-card);box-shadow:none;}
.state-empty svg{color:var(--c-ink-soft);opacity:.5;}
.state-error{border-radius:var(--r-tile);background:var(--c-coral-soft);}
.home-hero{border-radius:32px;background:linear-gradient(135deg,#2a6fd4 0%,#1f5fbf 45%,#123a73 100%);padding:26px 26px;}
[data-theme="dark"] .home-hero{background:linear-gradient(135deg,#2a62b4 0%,#1d4a8c 55%,#143663 100%);}
.home-hello{font-size:26px;}
.home-hero .btn-primary,[data-theme="dark"] .home-hero .btn-primary{background:#fff;color:#123a73;}
.home-hero .btn-ghost{background:rgba(255,255,255,.18);color:#fff;border:0;}
.home-hero .btn-ghost:hover{background:rgba(255,255,255,.3);color:#fff;}
.home-stat,.tm-stat{border:0;border-radius:var(--r-tile);box-shadow:none;padding:16px 18px;}
button.home-stat:hover,.tm-stat:hover{box-shadow:0 0 0 2px var(--c-primary-ring);border:0;}
.tm-stat.active{outline:0;box-shadow:inset 0 0 0 2px var(--c-primary);}
.home-empty{border-radius:var(--r-tile);border:1.5px dashed var(--c-border);}
.home-attn .ticket-card{background:var(--c-primary-soft);border:0;}
.home-count,.chip-count{min-width:26px;}
.home-h2{font-size:18px;}
.equip-thumb{border-radius:16px;}

/* ── Page header (หัวเรื่องใหญ่แบบ One UI) ── */
.page-header{margin:8px 0 20px;}
.page-header-icon{width:52px;height:52px;border-radius:50%;background:var(--c-primary-soft);}
.page-header-icon svg{color:var(--c-primary);width:26px;height:26px;}
.page-h1{font-size:28px;line-height:1.25;font-weight:700;letter-spacing:-.01em;}
.page-sub{font-size:14px;margin-top:4px;line-height:1.5;}

/* ── Sidebar (desktop / admin drawer) ── */
.sidebar{background:var(--c-bg);backdrop-filter:none;-webkit-backdrop-filter:none;border-right:1px solid var(--c-line);box-shadow:none;}
.sidebar-brand{border-bottom:0;padding:24px 22px 12px;}
.sidebar-logo{width:44px;height:44px;border-radius:50%;background:linear-gradient(145deg,#2f74da,#123a73);}
.sidebar-name{font-size:17px;}
.nav-list{padding:8px 14px;}
.nav-item{min-height:48px;padding:10px 16px;border-radius:999px;font-size:15px;margin-bottom:4px;}
.nav-item:hover{background:var(--c-surface-soft);}
.nav-item.active{background:var(--c-primary-soft);box-shadow:none;color:var(--c-primary-deep);}
.nav-item svg{width:20px;height:20px;}
.nav-group-label{padding:14px 16px 6px;}
.nav-badge{background:var(--c-warning-soft);}
.nav-item.active .nav-badge,[data-theme="dark"] .nav-item.active .nav-badge{background:var(--c-primary-fill);color:var(--c-on-primary);}
.sidebar-footer{border-top:1px solid var(--c-line);}
.sidebar-avatar{border-radius:50%;width:42px;height:42px;}
.sidebar-theme{width:100%;border-radius:999px;}

/* ── Topbar (mobile) ── */
.topbar{background:var(--c-bg);backdrop-filter:none;-webkit-backdrop-filter:none;border-bottom:1px solid transparent;box-shadow:none;height:var(--topbar-h);transition:border-color .2s;padding-left:12px;padding-right:12px;}
.topbar.scrolled{border-bottom-color:var(--c-line);}
.topbar-logo{border-radius:50%;width:36px;height:36px;background:linear-gradient(145deg,#2f74da,#123a73);box-shadow:none;}
.topbar-title{font-size:17px;}
.topbar-avatar{border-radius:50%;width:40px;height:40px;}
.topbar-theme{width:40px!important;height:40px!important;}
.topbar-menu-btn{width:44px;height:44px;border-radius:50%;}
.topbar-avatar-btn{border-radius:50%;min-width:44px;min-height:44px;display:grid;place-items:center;}
.topbar-dropdown{background:var(--c-card);backdrop-filter:none;-webkit-backdrop-filter:none;border:1px solid var(--c-line);border-radius:24px;box-shadow:0 12px 40px rgba(10,22,38,.22);padding:8px;min-width:230px;max-width:calc(100vw - 24px);}
.td-user{border-bottom:1px solid var(--c-line);word-break:break-all;}
.td-btn{min-height:48px;border-radius:16px;padding:0 14px;}
.td-btn:hover{background:var(--c-surface-soft);}
.td-btn.danger:hover{background:var(--c-coral-soft);}
.team-search-results,.ra-search-results{background:var(--c-card);backdrop-filter:none;-webkit-backdrop-filter:none;border:1px solid var(--c-line);border-radius:20px;box-shadow:0 12px 40px rgba(10,22,38,.2);padding:6px;}
.team-result-item,.ra-result-item{border-radius:14px;min-height:48px;}
.team-result-item:hover,.ra-result-item:hover{background:var(--c-surface-soft);}

/* ── Bottom nav (mobile): pill indicator ── */
.bottom-nav{height:calc(var(--bnav-h) + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);background:var(--c-card);backdrop-filter:none;-webkit-backdrop-filter:none;border-top:1px solid var(--c-line);box-shadow:none;}
.bnav-item{font-size:12px;gap:4px;font-weight:500;min-width:0;}
.bnav-item svg{width:24px;height:24px;box-sizing:content-box;padding:4px 18px;border-radius:999px;transition:background .2s;}
.bnav-item.active{color:var(--c-primary-deep);}
.bnav-item.active svg{background:var(--c-primary-soft);color:var(--c-primary);}
.bnav-item:focus-visible{outline:3px solid var(--c-primary);outline-offset:-3px;border-radius:16px;}

/* ── Toast ── */
.toast-wrap{width:max-content;max-width:calc(100vw - 32px);}
.toast{white-space:normal;text-align:left;background:var(--c-ink);color:var(--c-bg-solid);border-radius:999px;padding:12px 22px;max-width:100%;}
@media(max-width:768px){.toast-wrap{bottom:calc(var(--bnav-h) + 16px + env(safe-area-inset-bottom))!important;}}

/* ── Modal / bottom sheet ── */
.sd-overlay{background:rgba(8,16,30,.5);padding:20px;}
.sd-modal{background:var(--c-card);border:0;border-radius:32px;max-height:90vh;max-height:90dvh;}
.sd-head{background:var(--c-card);border-bottom:1px solid var(--c-line);padding:22px 24px 16px;}
.sd-title{font-size:20px;}
.sd-iconbtn,.sd-close{width:44px;height:44px;border-radius:50%;border:0;background:var(--c-surface-soft);color:var(--c-ink);}
.sd-iconbtn:hover,.sd-close:hover{background:var(--c-primary-soft);color:var(--c-primary);}
.sd-body{padding:20px 24px 26px;overscroll-behavior:contain;}
.sd-section-title{border-bottom:1px solid var(--c-line);}
.sd-photo{border-radius:20px;}
.tm-stage,.tm-confirm-box{border:0;background:var(--c-primary-soft);border-radius:24px;padding:18px 20px;}
.tm-choice{border:0;border-radius:20px;background:var(--c-card);box-shadow:inset 0 0 0 1.5px var(--c-line);}
.tm-choice:hover:not(:disabled){box-shadow:inset 0 0 0 2px var(--c-primary);}
.tm-actionbar{background:linear-gradient(var(--c-primary-soft),var(--c-primary-soft)),var(--c-card);}
.tm-stepper .dot{border-color:var(--c-border);}
.tm-stepper li.current .dot,.tm-stage-no{background:var(--c-primary-fill);border-color:var(--c-primary-fill);color:var(--c-on-primary);}
.tm-comment,.tm-reopen-box,.tm-step,.tm-notice,.tm-rate-panel{border-radius:18px;}
.tm-proc{border-radius:18px;}
.tm-printmenu{background:var(--c-card);border:1px solid var(--c-line);border-radius:22px;box-shadow:0 12px 40px rgba(10,22,38,.25);padding:8px;}
.tm-printmenu button{border-radius:14px;min-height:48px;}
.tm-card-actions .btn{min-height:40px;}
.tm-star{min-width:44px;min-height:44px;}
@media(max-width:768px){
  .sd-overlay{padding:0;align-items:flex-end;}
  .sd-modal,.sd-modal.sd-ticket,.sd-modal.wide{max-width:100%;max-height:94vh;max-height:94dvh;border-radius:32px 32px 0 0;animation:sdSheet .3s var(--ease);}
  .sd-modal::before{content:"";display:block;flex-shrink:0;width:40px;height:5px;border-radius:99px;background:var(--c-border);margin:10px auto 0;}
  .sd-head{padding:12px 16px 14px;}
  .sd-body{padding:16px 16px calc(22px + env(safe-area-inset-bottom));}
  .tm-actionbar .btn{flex:1 1 auto;}
}
@keyframes sdSheet{from{transform:translateY(40px);opacity:0;}to{transform:none;opacity:1;}}

/* ── Admin tables / toolbar ── */
.toolbar-row,.item-table-wrap,.history-table-wrap{background:var(--c-card);backdrop-filter:none;-webkit-backdrop-filter:none;border:0;border-radius:var(--radius-card);}
.toolbar-row{padding:14px 16px;}
.item-table td,.history-table td{border-bottom-color:var(--c-line);}
.history-table th{border-bottom-color:var(--c-line);}
.item-table tbody tr:hover,.history-table tbody tr:hover{background:var(--c-surface-soft);}
.eqh-table th,.eqh-table td{border-bottom-color:var(--c-line);}
.history-proof-link{border-radius:12px;border-color:var(--c-line);}
.tm-stats-main{gap:10px;}

/* ── Layout ── */
.portal-layout{min-height:100vh;min-height:100dvh;background:var(--c-bg);}
.portal-main{min-height:100vh;min-height:100dvh;}
.portal-content{padding:20px 32px 40px;}
@media(max-width:768px){
  .portal-content{padding:4px 16px 32px;}
  body:has(.bottom-nav) .portal-content{padding-bottom:calc(var(--bnav-h) + 28px + env(safe-area-inset-bottom));}
  .page-h1{font-size:26px;}
  .page-header{margin:4px 0 16px;}
  .page-header-icon{width:44px;height:44px;}
  .page-header-icon svg{width:22px;height:22px;}
  .card{padding:20px;border-radius:28px;}
  .form-actions .btn{flex:1 1 auto;}
  /* ลิ้นชักเมนูของหลังบ้าน: ปิดอยู่ต้องไม่รับโฟกัสจากคีย์บอร์ด/โปรแกรมอ่านหน้าจอ */
  .sidebar{width:min(300px,86vw);min-width:0;visibility:hidden;transition:transform .28s var(--ease),visibility 0s linear .28s;border-radius:0 32px 32px 0;background:var(--c-card);}
  .sidebar.open{visibility:visible;transition:transform .28s var(--ease),visibility 0s;box-shadow:8px 0 40px rgba(8,16,30,.3);}
  .sidebar-backdrop.show{background:rgba(8,16,30,.5);}
}
@media(max-width:380px){
  .page-h1{font-size:23px;}
  .home-hello{font-size:22px;}
  .bnav-item svg{padding:4px 14px;}
  .portal-content{padding-left:12px;padding-right:12px;}
  .chip-row-scroll{margin-right:-12px!important;padding-right:12px!important;}
}

/* ── แก้บั๊กเลย์เอาต์หัวเรื่อง/ฟอร์มบนมือถือ ── */
.page-header-left{align-items:flex-start;min-width:0;}
.page-header-left>div:last-child{min-width:0;}
.form-field>.chip-row:empty{display:none;}
@media(max-width:768px){
  .page-header-icon{display:none;}
  .page-sub{font-size:14px;}
}

/* ── ข้อความยาวไม่มีเว้นวรรค (อีเมล รหัส ชื่อไฟล์) ต้องตัดบรรทัด ไม่ดันการ์ดล้นจอ ── */
.ticket-card,.equip-card,.supply-card,.card,.home-stat,.tm-stat,.tm-stage,.tm-choice{min-width:0;max-width:100%;}
.ticket-card-head>div:first-child,.equip-info,.sd-head-info,.sd-row .v,.tm-comment-text,.tm-tl-title{min-width:0;}
.ticket-title,.ticket-meta,.ticket-reporter,.status-note,.equip-name,.equip-code,.equip-note,.sd-title,.sd-sub,.sd-row .v,.sd-text,.card-title,.page-h1,.page-sub,.home-hello,.home-sub,.td-user-name,.td-user-email,.tm-choice b,.tm-choice span,.team-result-name,.team-result-meta,.ra-result-name,.ra-result-meta{overflow-wrap:anywhere;word-break:break-word;}
.ticket-meta span{min-width:0;}
@media(max-width:768px){
  .equip-grid,.supply-grid{grid-template-columns:minmax(0,1fr)!important;}
  .ticket-card-head{flex-wrap:wrap;}
}
@media(max-width:380px){
  .home-hero-actions{flex-direction:column;}
  .home-hero-actions .btn{width:100%;white-space:nowrap;}
}
.collapse-toggle{min-height:44px;}
.bnav-item span{display:block;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
@media(max-width:380px){.bnav-item{font-size:11px;}}
