/* Hospital Ticket Tool - all rules scoped under .hht-app so the theme is not affected */
.hht-app{
  --hht-mint:#00e699; --hht-blue:#1a73e8; --hht-blue-l:#e8f0fe; --hht-red:#d93025; --hht-red-l:#fce8e6;
  --hht-yellow:#f9ab00; --hht-yellow-l:#fef7e0; --hht-green:#188038; --hht-green-l:#e6f4ea;
  --hht-border:#dadce0; --hht-text:#202124; --hht-muted:#5f6368;
  display:flex; width:100%; height:86vh; min-height:620px; overflow:hidden; position:relative;
  background:linear-gradient(180deg,#1b1238 0%,#150c2c 100%); color:var(--hht-text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  border-radius:16px; line-height:1.4; text-align:left;
}
.hht-app *{box-sizing:border-box}
.hht-app h1,.hht-app h2,.hht-app h3{margin:0;padding:0;line-height:1.3}

/* Login */
.hht-login-wrap{align-items:center;justify-content:center;height:auto;min-height:480px;padding:30px 16px}
.hht-login-box{background:#fff;width:100%;max-width:380px;padding:36px;border-radius:20px;box-shadow:0 10px 40px rgba(0,0,0,.4);text-align:center}
.hht-login-box h2{color:#1b1238;margin-bottom:6px;font-size:20px;font-weight:700}
.hht-login-box p{color:var(--hht-muted);font-size:13px;margin:0 0 18px}
.hht-login-logo{width:70px;height:70px;object-fit:contain;margin:0 auto 10px;display:block}
.hht-logo-fallback{font-size:34px;display:block;margin-bottom:6px}
.hht-login-box form label{display:block;text-align:left;font-size:12px;font-weight:600;color:var(--hht-muted);margin-bottom:4px}
.hht-login-box form input[type=text],.hht-login-box form input[type=password]{width:100%;padding:12px 14px;border:1px solid var(--hht-border);border-radius:8px;margin-bottom:14px;font-size:14px}
.hht-login-box form input[type=submit]{background:var(--hht-mint);color:#1b1238;width:100%;padding:12px;border:none;border-radius:24px;font-size:14px;font-weight:700;cursor:pointer}

/* Sidebar */
.hht-sidebar{width:230px;flex-shrink:0;padding:28px 18px;display:flex;flex-direction:column;justify-content:space-between}
.hht-user-profile{text-align:center;margin-bottom:22px}
.hht-avatar{width:58px;height:58px;border-radius:50%;border:2px dashed #44376b;margin:0 auto 10px;display:flex;align-items:center;justify-content:center;background:rgba(255,255,255,.04)}
.hht-avatar-img{width:44px;height:44px;object-fit:contain;border-radius:50%}
.hht-avatar .hht-logo-fallback{font-size:24px;margin:0}
.hht-profile-title{color:#fff;font-size:15px;font-weight:600;margin-bottom:2px}
.hht-profile-online{color:var(--hht-mint);font-size:10px;font-weight:700;text-transform:uppercase}
.hht-btn-new{background:var(--hht-mint);color:#150c2c;border:none;padding:12px 20px;border-radius:30px;font-weight:700;font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;width:100%;margin-bottom:26px}
.hht-btn-new:hover{background:#00c784}
.hht-nav{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.hht-nav li{margin:0;padding:0}
.hht-nav-item{color:#928ca8;display:flex;align-items:center;gap:14px;padding:10px 16px;border-radius:12px;font-size:14px;font-weight:500;cursor:pointer;transition:.2s}
.hht-nav-item:hover{color:#fff;background:rgba(255,255,255,.08)}
.hht-nav-item.active{color:var(--hht-mint);background:rgba(255,255,255,.08);font-weight:700}
.hht-signout{color:#928ca8!important;font-size:13px;padding:10px 16px;font-weight:500;text-decoration:none!important}
.hht-signout:hover{color:var(--hht-red)!important}

/* Main */
.hht-main{flex:1;min-width:0;background:#fff;border-top-left-radius:40px;display:flex;flex-direction:column;overflow:hidden;margin-top:10px}
.hht-top-header{padding:22px 32px 18px;display:flex;justify-content:space-between;align-items:center;gap:12px;border-bottom:1px solid #f1f3f4}
.hht-top-header h1{font-size:22px;color:#1b1238;font-weight:700}
.hht-search{background:#f1f3f8;border-radius:24px;padding:8px 16px;display:flex;align-items:center;gap:8px;width:280px;max-width:100%}
.hht-search input{border:none!important;background:transparent!important;outline:none;box-shadow:none!important;width:100%;font-size:13px;padding:0!important}

.hht-panel{display:none;flex:1;min-height:0;overflow:hidden}
.hht-panel.active{display:flex}
.hht-workspace{display:flex;flex:1;overflow:hidden;width:100%}
.hht-list-area{flex:1;padding:22px 32px;overflow-y:auto}
.hht-list-controls{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;font-size:13px;color:var(--hht-muted)}
.hht-live{color:var(--hht-green);font-weight:700}
.hht-empty{text-align:center;padding:40px 0;color:var(--hht-muted)}

.hht-row{background:#fff;border-bottom:1px solid #f1f3f4;padding:16px 12px}
.hht-row.overdue{border-left:3px solid var(--hht-red);padding-left:9px}
.hht-row-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.hht-row-main{display:flex;align-items:center;gap:14px;flex:1;min-width:0}
.hht-rep-avatar{width:36px;height:36px;border-radius:50%;background:#f1f3f9;display:flex;align-items:center;justify-content:center;font-size:16px;color:#6c5ce7;font-weight:700;flex-shrink:0}
.hht-rep-name{font-size:12px;font-weight:700;color:#1b1238;margin-bottom:2px}
.hht-rep-name b{color:var(--hht-blue)}
.hht-issue{font-size:14px;font-weight:600;color:var(--hht-text);word-break:break-word;white-space:pre-line}
.hht-meta{font-size:11px;color:var(--hht-muted);margin-top:3px}
.hht-dept-badge{background:var(--hht-blue-l);color:var(--hht-blue);padding:2px 6px;border-radius:4px;font-weight:600}
.hht-row-right{display:flex;align-items:center;gap:12px;flex-wrap:wrap;justify-content:flex-end}
.hht-time{font-size:12px;color:var(--hht-muted);white-space:nowrap}
.hht-prio{padding:4px 10px;border-radius:12px;font-size:11px;font-weight:700;text-transform:uppercase}
.hht-prio-Urgent,.hht-prio-Emergency{background:var(--hht-red-l);color:var(--hht-red)}
.hht-prio-High{background:var(--hht-yellow-l);color:#b06f00}
.hht-prio-Normal{background:#f1f3f8;color:var(--hht-muted)}
.hht-prio-Low{background:var(--hht-blue-l);color:var(--hht-blue)}
.hht-status-select{background:#f1f3f9;border:1px solid var(--hht-border);padding:5px 10px;border-radius:6px;font-size:12px;font-weight:600;cursor:pointer}
.hht-pill{background:var(--hht-green-l);color:var(--hht-green);padding:4px 10px;border-radius:6px;font-size:11px;font-weight:700}

.hht-remark{margin-top:10px;padding:10px 14px;background:#f8fafc;border-left:3px solid var(--hht-blue);border-radius:6px}
.hht-remark.done{border-left-color:var(--hht-green)}
.hht-remark-label{font-size:11px;font-weight:700;color:var(--hht-muted);margin-bottom:4px;display:block}
.hht-remark.done .hht-remark-label{color:var(--hht-green)}
.hht-remark-row{display:flex;gap:8px;align-items:center}
.hht-remark-input{flex:1;padding:7px 10px;border:1px solid var(--hht-border);border-radius:6px;font-size:12px}
.hht-btn-save{background:var(--hht-blue);color:#fff;border:none;padding:7px 16px;border-radius:6px;font-size:12px;font-weight:700;cursor:pointer}

.hht-filters{width:260px;flex-shrink:0;border-left:1px solid #f1f3f4;padding:22px 18px;background:#fff;overflow-y:auto}
.hht-filters h2{font-size:16px;font-weight:700;color:#1b1238;margin-bottom:18px}
.hht-filter-item{margin-bottom:16px}
.hht-filter-item label,.hht-group label{display:block;font-size:11px;font-weight:700;color:var(--hht-muted);margin-bottom:6px;text-transform:uppercase}
.hht-select{width:100%;border:1px solid #e1e3e8;padding:9px 12px;border-radius:8px;font-size:13px;background:#fff}

.hht-metrics{padding:32px 36px;width:100%;overflow-y:auto}
.hht-metrics h3{margin-bottom:12px;color:#1b1238}
.hht-muted{color:var(--hht-muted);font-size:14px;line-height:1.6;margin:0 0 18px}
.hht-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:18px}
.hht-stat{background:#fff;border:1px solid var(--hht-border);border-top:4px solid;border-radius:14px;padding:20px}
.hht-stat-label{font-size:12px;font-weight:700;color:var(--hht-muted);text-transform:uppercase}
.hht-stat-num{font-size:34px;font-weight:800;color:#1b1238;margin-top:8px}
.hht-dept-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:18px}
.hht-dept-card{background:#fff;border:1px solid var(--hht-border);border-radius:14px;padding:20px}
.hht-info-box{background:#f8fafd;border:1px solid var(--hht-border);border-radius:10px;padding:18px;font-size:13px;display:grid;gap:8px}

/* Modal */
.hht-modal-overlay{display:none;position:absolute;inset:0;background:rgba(20,11,44,.6);backdrop-filter:blur(3px);align-items:center;justify-content:center;z-index:50;padding:16px}
.hht-modal-overlay.open{display:flex}
.hht-modal-box{background:#fff;width:100%;max-width:500px;max-height:100%;overflow-y:auto;border-radius:16px;padding:26px}
.hht-modal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
.hht-close{border:none;background:none;font-size:24px;cursor:pointer;color:var(--hht-muted)}
.hht-group{margin-bottom:14px}
.hht-two{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.hht-control{width:100%;border:1px solid var(--hht-border);padding:9px 12px;border-radius:8px;font-size:13px;background:#fff}
.hht-btn-submit{background:#1b1238;color:var(--hht-mint);border:none;padding:12px;border-radius:8px;font-weight:700;font-size:14px;width:100%;cursor:pointer}
.hht-btn-submit:disabled{opacity:.6;cursor:wait}

.hht-toast{position:absolute;right:20px;bottom:20px;background:#1b1238;color:#fff;padding:10px 16px;border-radius:8px;font-size:13px;z-index:60;opacity:0;transition:opacity .25s;pointer-events:none}
.hht-toast.show{opacity:1}
.hht-toast.err{background:var(--hht-red)}

@media (max-width:900px){
  .hht-app{flex-direction:column;height:auto;min-height:0}
  .hht-sidebar{width:100%;padding:16px;gap:12px}
  .hht-user-profile{display:none}
  .hht-nav{flex-direction:row;flex-wrap:wrap}
  .hht-btn-new{margin-bottom:12px}
  .hht-main{border-radius:24px 24px 0 0;margin-top:0;min-height:520px}
  .hht-workspace{flex-direction:column;overflow:visible}
  .hht-filters{width:100%;border-left:none;border-top:1px solid #f1f3f4}
  .hht-stats{grid-template-columns:repeat(2,1fr)}
  .hht-top-header{flex-direction:column;align-items:flex-start;padding:18px}
  .hht-list-area,.hht-metrics{padding:18px}
  .hht-row-head{flex-direction:column;align-items:flex-start}
  .hht-row-right{justify-content:flex-start}
  .hht-panel.active{overflow:visible}
}

/* Responsive polish: fluid layouts from wide desktop down to small phones. */
.hht-app {
  width: 100%;
  max-width: 100%;
  height: min(86vh, 980px);
  min-height: 600px;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 18px 48px rgba(21,12,44,.12);
  isolation: isolate;
}
.hht-app button,
.hht-app input,
.hht-app select,
.hht-app textarea { font: inherit; }
.hht-app button,
.hht-app select,
.hht-app input { max-width: 100%; }
.hht-app button { touch-action: manipulation; }
.hht-app :focus-visible { outline: 3px solid rgba(26,115,232,.38); outline-offset: 2px; }
.hht-main { min-width: 0; }
.hht-list-area, .hht-metrics, .hht-filters { min-width: 0; }
.hht-search { min-width: 0; }
.hht-search input { min-width: 0; }
.hht-row { min-width: 0; border-radius: 10px; margin-bottom: 8px; }
.hht-row-head, .hht-row-main, .hht-row-right { min-width: 0; }
.hht-issue { overflow-wrap: anywhere; }
.hht-status-select, .hht-select, .hht-control, .hht-remark-input { min-height: 40px; }
.hht-btn-new, .hht-btn-save, .hht-btn-submit, .hht-signout, .hht-nav-item { min-height: 42px; }
.hht-modal-overlay { overflow-y: auto; }
.hht-modal-box { width: min(100%, 500px); }

@media (min-width: 901px) {
  .hht-sidebar { width: clamp(205px, 19vw, 250px); }
  .hht-filters { width: clamp(230px, 23vw, 300px); }
  .hht-list-area { padding: clamp(18px, 2vw, 32px); }
}

@media (max-width: 900px) {
  .hht-app {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    border-radius: 16px;
  }
  .hht-sidebar {
    width: 100%;
    flex: 0 0 auto;
    padding: 16px;
    gap: 10px;
    justify-content: flex-start;
  }
  .hht-sidebar > div { min-width: 0; }
  .hht-user-profile { display: none; }
  .hht-btn-new { width: 100%; margin: 0 0 12px; min-height: 46px; }
  .hht-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; }
  .hht-nav-item { justify-content: center; padding: 10px 8px; gap: 7px; text-align: center; }
  .hht-signout { display: inline-flex; align-items: center; margin-top: 8px; padding: 8px 10px; }
  .hht-main { width: 100%; min-height: 0; margin: 0; border-radius: 18px 18px 0 0; overflow: visible; }
  .hht-top-header { width: 100%; flex-direction: column; align-items: stretch; padding: 18px; gap: 12px; }
  .hht-top-header h1 { font-size: clamp(20px, 4vw, 24px); }
  .hht-search { width: 100%; min-height: 42px; }
  .hht-panel { min-height: 0; overflow: visible; }
  .hht-panel.active { display: block; overflow: visible; }
  .hht-workspace { display: flex; flex-direction: column; width: 100%; overflow: visible; }
  .hht-list-area, .hht-metrics { width: 100%; padding: 16px; overflow: visible; }
  .hht-list-controls { align-items: flex-start; gap: 8px; flex-wrap: wrap; }
  .hht-row { padding: 14px 10px; }
  .hht-row-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .hht-row-main { align-items: flex-start; }
  .hht-row-right { justify-content: flex-start; align-items: center; gap: 8px; }
  .hht-time { white-space: normal; }
  .hht-filters { width: 100%; flex: 0 0 auto; border: 0; border-top: 1px solid #edf0f5; padding: 18px 16px; overflow: visible; }
  .hht-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .hht-stat { min-width: 0; padding: 16px; }
  .hht-stat-num { font-size: clamp(25px, 5vw, 34px); overflow-wrap: anywhere; }
  .hht-dept-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
  .hht-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hht-modal-overlay { position: fixed; inset: 0; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .hht-modal-box { max-height: calc(100dvh - 24px); padding: 20px; border-radius: 16px; }
  .hht-toast { position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); text-align: center; }
}

@media (max-width: 520px) {
  .hht-app { border-radius: 12px; font-size: 14px; }
  .hht-sidebar { padding: 12px; }
  .hht-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hht-nav-item { font-size: 13px; }
  .hht-top-header { padding: 15px 14px; }
  .hht-list-area, .hht-metrics { padding: 12px; }
  .hht-row { padding: 12px 8px; }
  .hht-row-main { gap: 9px; }
  .hht-rep-avatar { width: 32px; height: 32px; }
  .hht-issue { font-size: 13px; }
  .hht-row-right { gap: 6px; }
  .hht-status-select { width: 100%; }
  .hht-remark-row { align-items: stretch; flex-direction: column; }
  .hht-remark-input, .hht-btn-save { width: 100%; min-height: 42px; }
  .hht-stats { gap: 8px; }
  .hht-stat { padding: 12px; border-radius: 10px; }
  .hht-stat-label { font-size: 10px; line-height: 1.4; }
  .hht-stat-num { font-size: 25px; }
  .hht-dept-card { padding: 15px; }
  .hht-info-box { padding: 14px; overflow-wrap: anywhere; }
  .hht-two { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hht-modal-box { padding: 16px; }
  .hht-login-wrap { padding: 18px 12px; }
  .hht-login-box { padding: 26px 20px; border-radius: 16px; }
}

@media (max-width: 360px) {
  .hht-nav { grid-template-columns: minmax(0, 1fr); }
  .hht-stats { grid-template-columns: minmax(0, 1fr); }
  .hht-row-right { align-items: stretch; flex-direction: column; }
  .hht-prio, .hht-pill { align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .hht-app *, .hht-app *::before, .hht-app *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
