/* Admin panel */
body.admin{background:var(--hm-bg)}
.app{display:grid;grid-template-columns:256px minmax(0,1fr);min-height:100vh}
.sidebar{background:#fff;border-right:1px solid var(--hm-border);position:sticky;top:0;height:100vh;overflow-y:auto;display:flex;flex-direction:column}
.sidebar .sb-brand{height:68px;display:flex;align-items:center;padding:0 20px;border-bottom:1px solid var(--hm-border)}
.sidebar .sb-brand img{height:34px;width:auto}
.sb-nav{padding:12px 12px 24px;flex:1}
.sb-group{font-size:var(--hm-fs-xs);font-weight:700;color:var(--hm-text-3);padding:16px 10px 6px}
.sb-nav a{display:flex;align-items:center;gap:11px;padding:9px 10px;border-radius:var(--r-md);color:var(--hm-text);font-weight:600;font-size:var(--hm-fs-sm);margin-bottom:1px}
.sb-nav a .ic{color:var(--hm-text-3)}
.sb-nav a:hover{background:var(--hm-neutral-soft);text-decoration:none}
.sb-nav a.active{background:var(--hm-primary-soft);color:var(--hm-primary)}
.sb-nav a.active .ic{color:var(--hm-primary)}
.sb-nav .count{margin-left:auto;background:var(--hm-accent);color:#3D2500;font-size:11px;font-weight:800;border-radius:99px;padding:1px 7px}
.sb-foot{padding:14px 20px;border-top:1px solid var(--hm-border);font-size:var(--hm-fs-xs);color:var(--hm-text-3)}
.topnav{height:68px;background:#fff;border-bottom:1px solid var(--hm-border);display:flex;align-items:center;gap:14px;padding:0 24px;position:sticky;top:0;z-index:70}
.topnav .global-search{flex:1;max-width:420px;position:relative}
.topnav .global-search .input{height:40px;padding-left:38px;background:var(--hm-surface-2)}
.topnav .global-search .ic{position:absolute;left:12px;top:12px;color:var(--hm-text-3)}
.topnav .tn-right{margin-left:auto;display:flex;align-items:center;gap:8px}
.notif-dot{position:relative}
.notif-dot::after{content:"";position:absolute;top:9px;right:10px;width:8px;height:8px;border-radius:50%;background:var(--hm-error);border:2px solid #fff}
.user-btn{display:flex;align-items:center;gap:10px;border:0;background:none;cursor:pointer;padding:4px 8px;border-radius:var(--r-md);font-family:var(--hm-font-body)}
.user-btn:hover{background:var(--hm-neutral-soft)}
.user-btn .u-name{font-weight:700;font-size:var(--hm-fs-sm);text-align:left;line-height:1.2}
.user-btn .u-role{font-size:var(--hm-fs-xs);color:var(--hm-text-2)}
.sb-toggle{display:none}
.content{padding:24px 28px 56px;min-width:0}
.page-head{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap;margin-bottom:22px}
.page-head h1{font-size:var(--hm-fs-2xl);margin:0}
.page-head p{margin:4px 0 0;color:var(--hm-text-2);font-size:var(--hm-fs-sm)}
.page-head .actions{display:flex;gap:8px;flex-wrap:wrap}
.breadcrumb{display:flex;flex-wrap:wrap;gap:6px;list-style:none;padding:0;margin:0 0 8px;font-size:var(--hm-fs-xs);color:var(--hm-text-2)}
.breadcrumb li+li::before{content:"/";margin-right:6px;color:var(--hm-text-3)}
.notif-list a{display:flex;gap:10px;align-items:flex-start;padding:10px;border-radius:var(--r-sm);color:var(--hm-text);font-size:var(--hm-fs-sm)}
.notif-list a:hover{background:var(--hm-neutral-soft);text-decoration:none}
.sb-overlay{display:none}
@media (max-width:1024px){
  .app{grid-template-columns:1fr}
  .sidebar{position:fixed;left:0;top:0;width:272px;z-index:110;transform:translateX(-100%);transition:transform .2s;box-shadow:var(--sh-3)}
  .sidebar.open{transform:none}
  .sb-overlay.open{display:block;position:fixed;inset:0;background:rgba(3,30,60,.45);z-index:105}
  .sb-toggle{display:inline-flex}
}
@media (max-width:640px){
  .content{padding:16px 14px 48px}
  .topnav{padding:0 12px;gap:6px}
  .topnav .global-search{display:none}
  .user-btn .u-text{display:none}
  .page-head .actions{width:100%}
  .page-head .actions .btn{flex:1}
}

.settings-layout{display:grid;grid-template-columns:220px minmax(0,1fr);gap:24px;align-items:start}
.settings-nav{background:#fff;border:1px solid var(--hm-border);border-radius:var(--r-lg);padding:8px;position:sticky;top:88px}
.settings-nav a{display:flex;gap:10px;align-items:center;padding:9px 12px;border-radius:var(--r-md);color:var(--hm-text);font-weight:600;font-size:var(--hm-fs-sm)}
.settings-nav a:hover{background:var(--hm-neutral-soft);text-decoration:none}
.settings-nav a.active{background:var(--hm-primary-soft);color:var(--hm-primary)}
@media (max-width:900px){.settings-layout{grid-template-columns:1fr}.settings-nav{position:static;display:flex;overflow-x:auto}.settings-nav a{white-space:nowrap}}
.set-section{margin-bottom:20px}
.set-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:16px;align-items:center;padding:14px 0;border-bottom:1px solid var(--hm-border)}
.set-row:last-child{border-bottom:0}
.set-row .sr-title{font-weight:700;font-size:var(--hm-fs-sm)}
.set-row .sr-desc{font-size:var(--hm-fs-xs);color:var(--hm-text-2)}
.unsaved-bar{position:sticky;bottom:12px;z-index:50;background:var(--hm-navy);color:#fff;border-radius:var(--r-lg);padding:12px 16px;display:flex;align-items:center;justify-content:space-between;gap:12px;box-shadow:var(--sh-3);margin-top:16px;flex-wrap:wrap}
.unsaved-bar .btn-outline{background:transparent;color:#fff;border-color:rgba(255,255,255,.4)}
.mode-pill{display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:99px;font-weight:800;font-size:var(--hm-fs-xs)}
.mode-pill.test{background:var(--hm-accent-soft);color:#8A5300}
.mode-pill.live{background:var(--hm-success-soft);color:var(--hm-success)}
.example-calc{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.example-calc div{background:var(--hm-surface-2);border:1px solid var(--hm-border);border-radius:var(--r-md);padding:12px 14px}
.example-calc b{display:block;font-family:var(--hm-font-display);font-size:1.25rem;color:var(--hm-navy)}
.example-calc span{font-size:var(--hm-fs-xs);color:var(--hm-text-2)}
@media (max-width:560px){.example-calc{grid-template-columns:1fr}}

.month-cal{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border-top:1px solid var(--hm-border);border-left:1px solid var(--hm-border)}
.month-cal .mc-dow{padding:8px;font-size:var(--hm-fs-xs);font-weight:700;color:var(--hm-text-2);background:var(--hm-surface-2);border-right:1px solid var(--hm-border);border-bottom:1px solid var(--hm-border)}
.month-cal .mc-day{min-height:108px;padding:6px;border-right:1px solid var(--hm-border);border-bottom:1px solid var(--hm-border);background:#fff;cursor:pointer;display:flex;flex-direction:column;gap:3px;text-align:left;font-family:var(--hm-font-body)}
.month-cal .mc-day:hover{background:#F9FBFE}
.month-cal .mc-day.other{background:var(--hm-surface-2);color:var(--hm-text-3)}
.month-cal .mc-day.sel{box-shadow:inset 0 0 0 2px var(--hm-primary)}
.month-cal .mc-num{font-weight:800;font-size:var(--hm-fs-sm)}
.month-cal .mc-ev{font-size:11px;padding:2px 6px;border-radius:5px;background:var(--hm-primary-soft);color:var(--hm-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600}
.month-cal .mc-ev.green{background:var(--hm-secondary-soft);color:var(--hm-secondary)}
.month-cal .mc-ev.red{background:var(--hm-error-soft);color:var(--hm-error)}
.month-cal .mc-more{font-size:11px;color:var(--hm-text-2);font-weight:600}
@media (max-width:760px){.month-cal .mc-day{min-height:58px}.month-cal .mc-ev{display:none}.month-cal .mc-day.has::after{content:"";width:6px;height:6px;border-radius:50%;background:var(--hm-primary)}}

.perm-table td:not(:first-child),.perm-table th:not(:first-child){text-align:center}
.perm-table input{width:18px;height:18px;accent-color:var(--hm-primary)}
.hours-row{display:grid;grid-template-columns:120px 90px 1fr 1fr;gap:10px;align-items:center;padding:8px 0;border-bottom:1px solid var(--hm-border)}
@media (max-width:560px){.hours-row{grid-template-columns:1fr 1fr}}
.invoice-paper{background:#fff;max-width:820px;margin:0 auto;padding:48px;border:1px solid var(--hm-border);border-radius:var(--r-md);box-shadow:var(--sh-2)}
.invoice-paper .inv-head{display:flex;justify-content:space-between;gap:24px;flex-wrap:wrap;margin-bottom:32px}
.invoice-paper .inv-head img{height:56px}
@media (max-width:640px){.invoice-paper{padding:20px}}
@media print{.sidebar,.topnav,.page-head .actions,.no-print{display:none!important}.app{display:block}.content{padding:0}.invoice-paper{box-shadow:none;border:0}}

.admin-auth{min-height:100vh;display:grid;grid-template-columns:1fr 1fr;background:#fff}
.admin-auth .aa-side{background:var(--hm-navy);color:#C9D7E8;padding:56px;display:flex;flex-direction:column;justify-content:space-between}
.admin-auth .aa-side h2{color:#fff;font-size:2rem;max-width:420px}
.admin-auth .aa-side .aa-logo{background:#fff;border-radius:var(--r-lg);padding:14px 18px;display:inline-block}
.admin-auth .aa-side .aa-logo img{height:40px}
.admin-auth .aa-main{display:grid;place-items:center;padding:32px 20px}
.admin-auth .aa-form{width:100%;max-width:400px}
@media (max-width:900px){.admin-auth{grid-template-columns:1fr}.admin-auth .aa-side{display:none}}
.audit{font-size:var(--hm-fs-sm)}
.audit li{padding:10px 0;border-bottom:1px solid var(--hm-border);list-style:none}
.audit{padding:0;margin:0}
.tpl-preview{border:1px solid var(--hm-border);border-radius:var(--r-md);background:var(--hm-surface-2);padding:20px;font-size:var(--hm-fs-sm);white-space:pre-wrap}
.wa-bubble{background:#DCF8C6;border-radius:12px 12px 12px 2px;padding:10px 12px;max-width:340px;font-size:var(--hm-fs-sm);white-space:pre-wrap;box-shadow:var(--sh-1)}
.main-col{min-width:0}
.dl-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 24px}
@media (max-width:640px){.dl-2{grid-template-columns:1fr}}
.option-row{display:grid;grid-template-columns:1.6fr .8fr .8fr .8fr .7fr auto;gap:8px;align-items:start;margin-bottom:8px}
.option-row .field{margin:0}
@media (max-width:760px){.option-row{grid-template-columns:1fr 1fr}}

/* Badges wrap inside narrow cards instead of forcing horizontal scroll at tablet widths (UI-01) */
.kpi .badge,.card-head .badge,.stat .badge{white-space:normal;max-width:100%;text-align:left}
.kpi,.card{min-width:0}
