:root{font-family:"DM Sans",Inter,system-ui,sans-serif;color:#20233b;background:#f7f8fc;font-synthesis:none;text-rendering:optimizeLegibility;--ink:#20233b;--muted:#7d829b;--line:#e9eaf2;--purple:#6553e8;--purple-2:#f0edff;--green:#13865b;--green-bg:#e8f7ef;--amber:#a86a06;--amber-bg:#fff4db;--red:#be4551;--red-bg:#fff0f1;--panel:#fff;--shadow:0 8px 28px rgba(27,32,75,.045)}*{box-sizing:border-box}body{margin:0;min-width:320px}button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{cursor:wait;opacity:.55}[hidden]{display:none!important}.app-shell{min-height:100vh;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{position:sticky;top:0;height:100vh;padding:27px 16px 20px;background:#fff;border-right:1px solid var(--line);display:flex;flex-direction:column}.brand{display:flex;align-items:center;gap:10px;color:#292844;text-decoration:none;font:800 19px Manrope,sans-serif;letter-spacing:-.6px;padding:0 9px}.brand-mark{width:29px;height:29px;border-radius:9px;object-fit:cover;box-shadow:0 5px 12px #6553e83b}.workspace-label{font-size:10px;letter-spacing:1.15px;color:#a0a3b5;font-weight:700;margin:47px 10px 12px}.primary-nav{display:grid;gap:5px}.nav-item{height:43px;border:0;border-radius:9px;text-align:left;background:transparent;color:#71758b;padding:0 12px;display:flex;align-items:center;gap:12px;font-size:13px;font-weight:600;transition:.15s}.nav-item:hover{background:#f7f6fc;color:var(--ink)}.nav-item.active{background:var(--purple-2);color:#5545d1}.nav-icon{width:17px;text-align:center;font-size:17px;font-weight:500}.sidebar-foot{margin-top:auto;border-top:1px solid var(--line);padding:17px 9px 0;color:#8b90a4;font-size:11px;display:flex;align-items:center;gap:8px}.status-dot{display:inline-block;width:7px;height:7px;border-radius:99px;background:#3da978;flex:none}.main-area{min-width:0}.topbar{height:69px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 clamp(22px,4.5vw,68px);gap:16px}.crumb{display:flex;gap:10px;align-items:center;color:#9a9db0;font-size:12px}.crumb strong{color:#3b3e54;font-weight:600}.crumb-sep{color:#d2d3de}.topbar-actions{display:flex;align-items:center;gap:18px}.admin-badge{display:inline-flex;align-items:center;gap:8px;color:#555b72;font-size:11px;font-weight:600;border:1px solid var(--line);border-radius:20px;padding:7px 10px;max-width:250px;overflow:hidden}.admin-badge span:last-child{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.exit-link{font-size:11px;color:#777b91;text-decoration:none}.exit-link:hover{color:var(--purple)}.content-wrap{max-width:none;width:100%;padding:24px clamp(20px,2.5vw,48px) 60px;margin:0}.page-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:25px}.eyebrow{display:block;font-size:9px;letter-spacing:1.15px;font-weight:700;color:#989bb0;margin-bottom:8px}.page-heading h1,.gate-card h1{font:700 29px/1.15 Manrope,sans-serif;letter-spacing:-.8px;color:#242640;margin:0}.page-heading p,.gate-card p{margin:8px 0 0;color:#8b8fa3;font-size:12px}.button{border:1px solid transparent;border-radius:8px;min-height:37px;padding:0 15px;font-size:11px;font-weight:700;transition:background .15s,border-color .15s,transform .15s;display:inline-flex;align-items:center;justify-content:center;gap:7px;text-decoration:none}.button:active{transform:translateY(1px)}.button-primary{background:var(--purple);color:white;box-shadow:0 4px 10px #6553e826}.button-primary:hover{background:#5645db}.button-quiet{background:#fff;color:#666b82;border-color:#e4e5ef}.button-quiet:hover{background:#fafaff;border-color:#d5d2f1;color:#5748d8}.button-danger{background:#c5505b;color:#fff}.button-danger:hover{background:#a83d48}.button-small{min-height:30px;padding:0 10px;font-size:10px}.button-full{width:100%;margin-top:7px}.filter-bar{display:flex;align-items:flex-end;gap:12px;padding:14px 15px;background:#fff;border:1px solid var(--line);border-radius:11px;margin-bottom:20px;box-shadow:var(--shadow)}.filter-bar label,.month-range label{display:grid;gap:5px;color:#81869a;font-size:10px;font-weight:600}.filter-bar input,.filter-bar select,.month-range input{height:34px;min-width:125px;border:1px solid #e6e7ef;background:#fff;border-radius:7px;color:#3c4057;padding:0 9px;font-size:11px;outline:none}.filter-bar input:focus,.filter-bar select:focus,input:focus,select:focus,textarea:focus{border-color:#958ae9;box-shadow:0 0 0 3px #6553e814;outline:none}.customer-filters .search-field{display:flex;align-items:center;gap:8px;border:1px solid #e6e7ef;border-radius:7px;min-width:250px;padding:0 10px;color:#9a9db0}.search-field input{border:0;box-shadow:none!important;min-width:0;width:100%;padding:0}.search-field span{font-size:20px}.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px}.kpi-card,.skeleton-card{min-height:126px;border:1px solid var(--line);border-radius:11px;background:#fff;box-shadow:var(--shadow);padding:18px 19px}.kpi-card{position:relative;overflow:hidden}.kpi-card:after{content:"";position:absolute;width:75px;height:75px;border-radius:50%;background:#f1efff;right:-20px;top:-22px}.kpi-label{display:flex;align-items:center;gap:8px;color:#858aa0;font-size:10px;font-weight:600;position:relative;z-index:1}.kpi-icon{width:25px;height:25px;border-radius:7px;background:#f1efff;color:#6654df;display:grid;place-items:center;font-size:14px}.kpi-value{font:700 25px Manrope,sans-serif;letter-spacing:-.8px;margin-top:14px;color:#292b44;position:relative;z-index:1}.kpi-foot{margin-top:4px;color:#a1a4b3;font-size:9px}.skeleton-card{background:linear-gradient(100deg,#fff 20%,#f7f7fb 45%,#fff 70%);background-size:200% 100%;animation:shimmer 1.3s infinite}@keyframes shimmer{to{background-position:-200% 0}}.panel{background:#fff;border:1px solid var(--line);border-radius:11px;box-shadow:var(--shadow)}.overview-detail{padding:20px}.panel-head{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:17px 19px;border-bottom:1px solid #eff0f5}.panel-head h2{margin:0;color:#32354d;font:700 14px Manrope,sans-serif;letter-spacing:-.2px}.panel-head p{margin:5px 0 0;color:#9498aa;font-size:10px}.panel-icon{width:31px;height:31px;background:#f1efff;color:#6553e8;display:grid;place-items:center;border-radius:9px}.overview-detail .panel-head{padding:0 0 15px;border:0}.overview-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.metric-item{border-top:1px solid #eff0f5;padding:15px 0 0}.metric-item span{display:block;color:#9397a9;font-size:10px}.metric-item strong{display:block;color:#464960;font-size:13px;margin-top:6px}.table-panel{overflow:hidden;margin-bottom:18px}.table-scroll{overflow:auto}table{width:100%;border-collapse:collapse;min-width:710px}th{background:#fbfbfd;color:#989bad;font-size:9px;text-transform:uppercase;letter-spacing:.45px;text-align:left;font-weight:700;padding:12px 15px;border-bottom:1px solid #eff0f5;white-space:nowrap}td{padding:13px 15px;border-bottom:1px solid #f0f1f6;color:#62677d;font-size:11px;vertical-align:middle}tbody tr:last-child td{border-bottom:0}.customer-name{color:#34374f;font-weight:700;font-size:11px}.subtext{display:block;color:#a0a3b2;font-size:9px;margin-top:4px}.badge{display:inline-flex;align-items:center;gap:5px;border-radius:20px;padding:5px 8px;font-size:9px;font-weight:700;white-space:nowrap}.badge-green{color:var(--green);background:var(--green-bg)}.badge-amber{color:var(--amber);background:var(--amber-bg)}.badge-red{color:var(--red);background:var(--red-bg)}.badge-neutral{color:#6b6f86;background:#f0f1f5}.badge-purple{color:#5849d0;background:#f0edff}.row-action{border:0;background:transparent;color:#6553e8;font-size:10px;font-weight:700;padding:6px}.row-action:hover{text-decoration:underline}.row-action.danger{color:#bb4b57}.table-state{padding:35px 15px!important;text-align:center!important;color:#a1a4b3!important;font-size:11px!important}.table-footer{height:53px;padding:0 15px;border-top:1px solid #eff0f5;display:flex;align-items:center;justify-content:space-between;color:#9699aa;font-size:10px}.pagination{display:flex;gap:7px}.notice{display:flex;align-items:flex-start;gap:10px;padding:12px 14px;border-radius:9px;margin-bottom:15px;font-size:11px}.notice p{margin:0;color:#7e8198;line-height:1.55}.notice-info{background:#f1f0ff;border:1px solid #e6e2ff;color:#6958d9}.commission-panel{margin-top:20px}.legend{display:flex;gap:7px;align-items:center;color:#898da1;font-size:9px;white-space:nowrap}.amber-dot{background:#efa82c}.green-dot{background:#35a875}.cost-layout{display:grid;grid-template-columns:minmax(280px,.75fr) minmax(0,1.55fr);gap:17px;align-items:start}.cost-form{padding-bottom:18px}.cost-form>.panel-head{margin:-1px -1px 17px}.cost-form>label,.cost-form .form-row{margin:0 18px 13px}.cost-form label{display:grid;gap:6px;color:#7c8195;font-size:10px;font-weight:600}.cost-form input,.cost-form select,.cost-form textarea,.dialog-fields input,.dialog-fields select,.dialog-fields textarea{width:100%;border:1px solid #e6e7ef;background:#fff;border-radius:7px;color:#42465c;padding:9px 10px;font-size:11px;outline:none}.cost-form input,.cost-form select{height:36px;padding-top:0;padding-bottom:0}.cost-form textarea,.dialog-fields textarea{resize:vertical;min-height:62px}.form-row{display:grid;grid-template-columns:1fr 1fr;gap:11px}.cost-form .button-full{width:calc(100% - 36px);margin:4px 18px 0}.costs-list-panel{overflow:hidden}.month-range{display:flex;align-items:flex-end;gap:8px}.month-range input{min-width:112px;height:30px}.month-range label{font-size:9px}.cost-item{padding:13px 18px;display:flex;align-items:center;justify-content:space-between;gap:10px;border-bottom:1px solid #f0f1f6}.cost-item:last-child{border:0}.cost-title{font-size:11px;color:#45495f;font-weight:700}.cost-detail{font-size:9px;color:#9b9eae;margin-top:4px}.cost-amount{font-size:12px;color:#35384d;font-weight:700;white-space:nowrap}.costs-total{border-top:1px solid var(--line);background:#fafaff;padding:13px 18px;display:flex;justify-content:space-between;color:#666b82;font-size:10px}.costs-total strong{color:#3c4058;font-size:12px}.drawer-backdrop{position:fixed;inset:0;background:#22233c66;z-index:10;display:flex;justify-content:flex-end}.customer-drawer{height:100%;width:min(480px,100%);background:#fafbfe;box-shadow:-12px 0 40px #1718321a;display:flex;flex-direction:column;animation:slide-in .18s ease-out}@keyframes slide-in{from{transform:translateX(20px);opacity:.7}to{transform:translateX(0);opacity:1}}.drawer-head{padding:22px 22px 17px;background:#fff;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}.drawer-head .eyebrow{margin-bottom:5px}.drawer-head h2{font:700 18px Manrope;margin:0;color:#30334a}.icon-button{width:32px;height:32px;border:1px solid var(--line);background:#fff;border-radius:8px;color:#767a8f;font-size:21px;line-height:1}.drawer-content{padding:19px 22px;overflow:auto;flex:1}.detail-card{border:1px solid var(--line);background:#fff;border-radius:10px;padding:15px;margin-bottom:12px}.detail-card h3{margin:0 0 12px;font:700 11px Manrope;color:#4c5067}.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px}.detail-field span{display:block;color:#9a9dae;font-size:9px}.detail-field strong{display:block;color:#45495f;font-size:11px;margin-top:5px;word-break:break-word}.drawer-actions{padding:15px 20px;border-top:1px solid var(--line);background:#fff;display:flex;flex-wrap:wrap;gap:8px}.drawer-actions .button{flex:1;min-width:120px}.action-dialog{border:1px solid var(--line);padding:0;border-radius:14px;width:min(420px,calc(100% - 28px));box-shadow:0 25px 90px #17183233;color:var(--ink)}.action-dialog::backdrop{background:#22233c73;backdrop-filter:blur(2px)}.action-dialog form{padding:24px}.dialog-mark{height:38px;width:38px;border-radius:11px;background:#f1efff;color:#6653e8;display:grid;place-items:center;font-weight:800;margin-bottom:13px}.dialog-mark.danger{background:var(--red-bg);color:var(--red)}.action-dialog h2{font:700 18px Manrope;margin:0;color:#30334a}.action-dialog p{font-size:11px;line-height:1.55;color:#83879b;margin:8px 0 17px}.dialog-fields{display:grid;gap:11px}.dialog-fields label{display:grid;gap:5px;color:#7c8195;font-size:10px;font-weight:600}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:21px}.global-alert{padding:12px 14px;border-radius:9px;margin-bottom:17px;font-size:11px;line-height:1.5}.global-alert.error{background:#fff0f1;border:1px solid #ffdbdf;color:#aa3c49}.global-alert.success{background:#e8f7ef;border:1px solid #cfefdd;color:#287b59}.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:20;padding:11px 17px;border-radius:9px;background:#292b43;color:white;box-shadow:0 8px 25px #20233b33;font-size:11px;max-width:min(500px,calc(100% - 30px))}.login-gate{min-height:100vh;display:grid;place-items:center;padding:30px;background:radial-gradient(ellipse at top,#efedff 0,transparent 47%),#f8f9fc}.login-gate>.brand{position:absolute;top:28px;left:32px}.gate-card{width:min(440px,100%);background:white;border:1px solid var(--line);box-shadow:var(--shadow);border-radius:15px;padding:31px}.gate-card p{line-height:1.7;margin:12px 0 23px}.gate-card .eyebrow{color:#6d5ce1}.gate-card .button{height:42px;width:100%}
@media(max-width:1000px){.app-shell{grid-template-columns:190px minmax(0,1fr)}.sidebar{padding-left:12px;padding-right:12px}.content-wrap{padding-left:26px;padding-right:26px}.kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.cost-layout{grid-template-columns:1fr}.cost-form{max-width:none}.cost-form .form-row{max-width:none}}
@media(max-width:700px){.app-shell{display:block}.sidebar{position:sticky;z-index:5;top:0;height:auto;padding:10px 13px;border-right:0;border-bottom:1px solid var(--line);display:flex;flex-direction:row;align-items:center;gap:12px}.brand{font-size:16px;gap:7px;padding:0}.brand-mark{width:26px;height:26px}.workspace-label,.sidebar-foot{display:none}.primary-nav{display:flex;gap:3px;margin-left:auto;overflow:auto}.nav-item{height:34px;padding:0 9px;font-size:0;gap:0;white-space:nowrap}.nav-icon{font-size:16px;width:20px}.topbar{height:54px;padding:0 17px}.topbar-actions{gap:9px}.admin-badge{max-width:150px;font-size:9px;padding:6px 8px}.exit-link{font-size:0}.exit-link:first-letter{font-size:15px}.content-wrap{padding:27px 16px 55px}.page-heading{align-items:flex-start;margin-bottom:18px}.page-heading h1{font-size:24px}.page-heading p{font-size:11px;max-width:250px}.page-heading>.button{min-height:32px;padding:0 9px;font-size:9px}.filter-bar{flex-wrap:wrap;gap:9px}.filter-bar label{flex:1}.filter-bar input,.filter-bar select{width:100%;min-width:0}.overview-filters .button,.customer-filters>.button{flex:1}.customer-filters .search-field{min-width:100%;flex:auto;height:35px}.customer-filters .search-field input{height:31px}.kpi-grid{gap:9px}.kpi-card,.skeleton-card{min-height:111px;padding:13px}.kpi-value{font-size:21px}.kpi-label{font-size:9px}.overview-metrics{grid-template-columns:repeat(2,minmax(0,1fr));row-gap:16px}.overview-detail{padding:15px}.panel-head{padding:14px}.panel-head h2{font-size:13px}.panel-head p{font-size:9px}.table-footer{padding:0 10px}.pagination{gap:4px}.button-small{padding:0 7px;font-size:9px}.cost-layout{gap:12px}.month-range{flex-wrap:wrap;justify-content:flex-end}.month-range label{min-width:80px}.month-range input{min-width:0;width:100%}.month-range .button{height:30px}.costs-list-panel .panel-head{align-items:flex-start;flex-wrap:wrap}.legend{margin-left:auto}.form-row{grid-template-columns:1fr}.drawer-head{padding:17px}.drawer-content{padding:15px 17px}.drawer-actions{padding:12px}.drawer-actions .button{min-width:calc(50% - 5px)}.dialog-fields .form-row{display:grid}}
@media(max-width:390px){.nav-item{padding:0 6px}.nav-icon{width:18px}.topbar{padding:0 12px}.content-wrap{padding-left:12px;padding-right:12px}.kpi-grid{grid-template-columns:1fr 1fr}.kpi-card{padding:11px}.admin-badge{max-width:120px}.overview-filters label{min-width:90px}}
.detail-list-row{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding:10px 0;border-top:1px solid #f0f1f6;color:#4a4e64;font-size:10px}.detail-list-row:first-of-type{border-top:0}.detail-list-row strong{font-size:10px}.detail-list-row small{display:block;color:#989bac;font-size:9px;line-height:1.5;margin-top:3px}.picker-results{max-height:230px;overflow:auto;border:1px solid var(--line);border-radius:8px}.picker-result{width:100%;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 11px;border:0;border-bottom:1px solid #f0f1f6;background:#fff;text-align:left;color:#6553e8;font-size:10px}.picker-result:last-child{border-bottom:0}.picker-result:hover,.picker-result.selected{background:#f4f2ff}.picker-result strong{display:block;color:#40445a;font-size:10px}.picker-result small{display:block;color:#999cad;margin-top:4px;font-size:9px}.picker-result>span:last-child{white-space:nowrap;font-weight:700}
/* Customer card opens as a centered modal dialog. */
.drawer-backdrop{display:flex;align-items:center;justify-content:center;padding:24px;background:#22233c73;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}
.drawer-backdrop .customer-drawer{width:min(760px,100%);height:min(780px,calc(100vh - 48px));border:1px solid var(--line);border-radius:16px;box-shadow:0 25px 90px #17183233;animation:customer-modal-in .18s ease-out}
@keyframes customer-modal-in{from{transform:translateY(8px) scale(.985);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}
@media(max-width:700px){.drawer-backdrop{padding:12px}.drawer-backdrop .customer-drawer{height:min(88dvh,820px);width:100%;border-radius:13px}}
.action-dialog[open]{position:fixed;inset:0;margin:auto;max-height:calc(100dvh - 32px);overflow-y:auto}

/* Clickable customer rows */
#customer-rows tr {
  cursor: pointer;
  transition: background-color .15s ease;
}
#customer-rows tr:hover td {
  background-color: #f7f6ff;
}
#customer-rows tr:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: -2px;
}

/* Customer Modal v2 (scheda-account-v2) */
:root {
  --bg: #f5f6fb;
  --sf: #fff;
  --s2: #f8f9fd;
  --bd: #e6e8f2;
  --tx: #14163d;
  --mt: #646a8c;
  --pr: #4f46e5;
  --pl: #eef0ff;
  --gr: #0c8f69;
  --gl: #e4f6ef;
  --am: #96650a;
  --al: #fff4d9;
  --rd: #c2374a;
  --rl: #fdeaed;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 16, 38, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  display: flex;
  padding: 0;
}
.drawer-backdrop .customer-drawer {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  background: var(--bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: customer-modal-in .16s ease-out;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--tx);
}
@keyframes customer-modal-in {
  from { transform: translateY(12px) scale(.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.customer-drawer .sh { display: flex; flex-direction: column; height: 100%; min-height: 0; width: 100%; max-width: 100%; min-width: 0; overflow: hidden; }
.customer-drawer .bar { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 16px 0 20px; background: var(--sf); border-bottom: 1px solid var(--bd); flex: none; color: var(--mt); font-size: 13.5px; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.customer-drawer .bar b { color: var(--tx); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-drawer .bar .x { margin-left: auto; }
.customer-drawer .ib { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--bd); background: var(--sf); display: inline-grid; place-items: center; color: var(--tx); transition: all .15s; flex: none; cursor: pointer; padding: 0; }
.customer-drawer .ib:hover { background: var(--pl); border-color: var(--pr); color: var(--pr); }

.customer-drawer .wrap { flex: 1; display: flex; min-height: 0; width: 100%; max-width: 100%; min-width: 0; overflow: hidden; }
.customer-drawer .rail { width: 320px; flex: none; background: var(--sf); border-right: 1px solid var(--bd); padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.customer-drawer .who { display: flex; gap: 12px; align-items: center; }
.customer-drawer .av { width: 52px; height: 52px; border-radius: 50%; background: var(--pl); color: var(--pr); display: grid; place-items: center; font-size: 22px; font-weight: 700; flex: none; }
.customer-drawer .who h1 { font-size: 20px; color: var(--tx); font-weight: 700; margin: 0; line-height: 1.2; word-break: break-word; }
.customer-drawer .cp { border: 0; background: none; padding: 0; color: var(--mt); display: flex; gap: 6px; align-items: center; font-size: 12px; word-break: break-all; text-align: left; cursor: pointer; }
.customer-drawer .cp:hover { color: var(--pr); }
.customer-drawer .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.customer-drawer .tg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--pl); color: var(--pr); }
.customer-drawer .tg.gr { background: var(--gl); color: var(--gr); }
.customer-drawer .tg.am { background: var(--al); color: var(--am); }
.customer-drawer .tg.rd { background: var(--rl); color: var(--rd); }
.customer-drawer .tg:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.customer-drawer .cr { border: 1px solid var(--bd); border-radius: 12px; padding: 14px; background: var(--s2); }
.customer-drawer .cr small { color: var(--mt); display: block; font-size: 11px; }
.customer-drawer .cr b { font-size: 30px; line-height: 1.2; color: var(--tx); font-weight: 700; display: block; }
.customer-drawer .meter { height: 6px; border-radius: 9px; background: var(--pl); margin: 8px 0; overflow: hidden; }
.customer-drawer .meter i { display: block; height: 100%; background: var(--pr); border-radius: 9px; }

.customer-drawer .fx { margin: 0; display: grid; gap: 0; }
.customer-drawer .fx div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--bd); gap: 10px; font-size: 12.5px; }
.customer-drawer .fx dt { color: var(--mt); }
.customer-drawer .fx dd { margin: 0; font-weight: 600; color: var(--tx); text-align: right; word-break: break-all; }
.customer-drawer .acts { display: grid; gap: 8px; margin-top: auto; padding-top: 10px; }

.customer-drawer .bt { display: inline-flex; gap: 8px; align-items: center; justify-content: center; height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--bd); background: var(--sf); font-weight: 600; font-size: 13.5px; white-space: nowrap; cursor: pointer; transition: all .15s; color: var(--tx); text-decoration: none; }
.customer-drawer .bt:hover { border-color: var(--pr); background: var(--pl); color: var(--pr); }
.customer-drawer .bt.pr { background: var(--pr); border-color: var(--pr); color: #fff; }
.customer-drawer .bt.pr:hover { background: #4338ca; border-color: #4338ca; }
.customer-drawer .bt.sm { height: 34px; font-size: 13px; border-radius: 8px; }
.customer-drawer .bt.rd { background: var(--rd); border-color: var(--rd); color: #fff; }
.customer-drawer .bt:disabled { opacity: .45; cursor: not-allowed; }
.customer-drawer .ln { border: 0; background: none; color: var(--rd); font-weight: 600; display: flex; gap: 6px; align-items: center; padding: 6px 0; justify-content: center; width: 100%; cursor: pointer; font-size: 13px; }
.customer-drawer .ln:hover { text-decoration: underline; }

.customer-drawer .main { flex: 1; min-width: 0; max-width: 100%; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.customer-drawer .tabs, #customer-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  background: var(--sf);
  border-bottom: 1px solid var(--bd);
  flex: none;
  min-height: 48px;
  height: 48px;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  white-space: nowrap;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.customer-drawer .tabs::-webkit-scrollbar, #customer-tabs::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.customer-drawer .tab {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 0 14px;
  height: 100%;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--mt);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  flex: none;
  flex-shrink: 0;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  box-sizing: border-box;
  text-decoration: none;
}
.customer-drawer .tab svg { flex: none; }
.customer-drawer .tab:hover { color: var(--pr); }
.customer-drawer .tab.on { color: var(--pr); border-bottom-color: var(--pr); }
.customer-drawer .tab em { font-style: normal; font-size: 11px; background: var(--bg); color: var(--mt); padding: 1px 7px; border-radius: 99px; flex: none; }
.customer-drawer .tab.on em { background: var(--pl); color: var(--pr); font-weight: 700; }

.customer-drawer .pane { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.customer-drawer .pane.ms { overflow: hidden; padding: 16px 20px; min-width: 0; }

.customer-drawer .cd { background: var(--sf); border: 1px solid var(--bd); border-radius: 12px; min-width: 0; overflow: hidden; }
.customer-drawer .cd > h3, .customer-drawer .ct { font-size: 14.5px; font-weight: 700; padding: 14px 16px 6px; display: flex; gap: 8px; align-items: center; justify-content: space-between; color: var(--tx); margin: 0; }
.customer-drawer .cd > h3 span { display: flex; gap: 8px; align-items: center; }
.customer-drawer .cd > h3 svg { color: var(--pr); }
.customer-drawer .cb { padding: 4px 16px 12px; }

.customer-drawer .g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.customer-drawer .g1 { display: grid; gap: 16px; }
.customer-drawer .kp { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.customer-drawer .kp > div { background: var(--sf); border: 1px solid var(--bd); border-radius: 12px; padding: 14px 16px; }
.customer-drawer .kp small { color: var(--mt); display: block; font-size: 11px; }
.customer-drawer .kp b { font-size: 22px; display: block; margin-top: 3px; color: var(--tx); font-weight: 700; }
.customer-drawer .kp span { font-size: 12px; display: block; margin-top: 2px; }

.customer-drawer .kv { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
.customer-drawer .kv.one { grid-template-columns: 1fr; }
.customer-drawer .r { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--bd); font-size: 13px; align-items: center; }
.customer-drawer .r span { color: var(--mt); }
.customer-drawer .r b { font-weight: 600; text-align: right; word-break: break-all; color: var(--tx); }
.customer-drawer .cd .cb > .r:last-child, .customer-drawer .kv.one > .r:last-child { border: 0; }

.customer-drawer .note { display: flex; gap: 10px; align-items: flex-start; background: var(--al); color: var(--am); border: 1px solid #f1dfae; border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.45; }
.customer-drawer .note.in { background: var(--pl); color: #3b37a8; border-color: #d8dbff; }
.customer-drawer details summary { cursor: pointer; color: var(--pr); font-weight: 600; padding: 10px 0; list-style: none; font-size: 13px; }
.customer-drawer details summary:before { content: "▸ "; }
.customer-drawer details[open] summary:before { content: "▾ "; }
.customer-drawer .empty { text-align: center; color: var(--mt); padding: 22px 10px; font-size: 13px; }
.customer-drawer .empty b { display: block; color: var(--tx); font-size: 14px; margin-bottom: 3px; }
.customer-drawer .dn,
.customer-drawer .r b.dn,
.customer-drawer .r b .dn,
.customer-drawer .r .dn,
.customer-drawer td.dn,
.customer-drawer td.dn b,
.credit-badge.dn {
  color: var(--rd) !important;
  font-weight: 700;
}
.customer-drawer .up,
.customer-drawer .r b.up,
.customer-drawer .r b .up,
.customer-drawer .r .up,
.customer-drawer td.up,
.customer-drawer td.up b,
.credit-badge.up {
  color: var(--gr) !important;
  font-weight: 700;
}
.customer-drawer .mt,
.credit-badge.mt {
  color: var(--mt);
}

.credit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.credit-badge.dn {
  background: var(--rl);
  border: 1px solid #fbd0d5;
}
.credit-badge.up {
  background: var(--gl);
  border: 1px solid #bbf0dc;
}
.credit-badge.mt {
  background: var(--s2);
  border: 1px solid var(--bd);
}

/* Master-detail layout */
.customer-drawer .md { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); gap: 18px; height: 100%; }
.customer-drawer .md > section { min-height: 0; display: flex; flex-direction: column; background: var(--sf); border: 1px solid var(--bd); border-radius: 12px; overflow: hidden; }
.customer-drawer .hd { padding: 12px 14px; border-bottom: 1px solid var(--bd); display: grid; gap: 10px; flex: none; }
.customer-drawer .sc { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; }
.customer-drawer .srch { display: flex; gap: 8px; align-items: center; height: 38px; border: 1px solid var(--bd); border-radius: 10px; padding: 0 12px; background: var(--s2); color: var(--mt); font-size: 13px; }
.customer-drawer .srch:focus-within { border-color: var(--pr); box-shadow: 0 0 0 3px var(--pl); }
.customer-drawer .srch input { border: 0; background: none; outline: 0; flex: 1; min-width: 0; color: var(--tx); font-size: 13px; padding: 0; }
.customer-drawer .seg { display: flex; background: var(--s2); border: 1px solid var(--bd); border-radius: 10px; padding: 3px; gap: 2px; }
.customer-drawer .seg button { flex: 1; border: 0; background: none; padding: 6px 8px; border-radius: 8px; font-weight: 600; color: var(--mt); font-size: 12.5px; white-space: nowrap; cursor: pointer; transition: all .15s; }
.customer-drawer .seg .on { background: #fff; color: var(--pr); box-shadow: 0 1px 3px rgba(20, 22, 61, .14); }

.customer-drawer .li { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; background: none; margin-bottom: 4px; cursor: pointer; transition: background .12s, border-color .12s; }
.customer-drawer .li:hover { background: var(--s2); }
.customer-drawer .li.on { background: var(--pl); border-color: #cfd3ff; }
.customer-drawer .th { display: flex; width: 84px; height: 56px; border-radius: 8px; overflow: hidden; flex: none; background: #e6e8f2; gap: 2px; }
.customer-drawer .th > div { flex: 1; position: relative; overflow: hidden; background: #dfe1ea; display: flex; align-items: center; justify-content: center; }
.customer-drawer .th img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .15s; }
.customer-drawer .th img.loaded { opacity: 1; }
.customer-drawer .li .t { flex: 1; min-width: 0; }
.customer-drawer .li b { display: block; font-size: 13.5px; color: var(--tx); }
.customer-drawer .li .t span { color: var(--mt); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.customer-drawer .ph { background: var(--c, #d9d6cf); display: grid; place-items: center; color: rgba(20, 22, 61, .25); width: 100%; height: 100%; border-radius: inherit; }

.customer-drawer .dt { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.customer-drawer .dt h2 { font-size: 19px; color: var(--tx); margin: 0; font-weight: 700; }
.customer-drawer .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.customer-drawer .chip { background: var(--s2); border: 1px solid var(--bd); border-radius: 8px; padding: 3px 10px; font-size: 12px; color: var(--mt); }
.customer-drawer .chip b { color: var(--tx); font-weight: 600; }

/* Open Carousel in Generation Detail */
.gen-carousel { background: var(--sf); border: 1px solid var(--bd); border-radius: 14px; overflow: hidden; margin-bottom: 18px; box-shadow: 0 4px 18px rgba(20, 22, 61, 0.05); }
.gen-carousel-stage { position: relative; background: #f8f9fd; border-bottom: 1px solid var(--bd); display: flex; align-items: center; justify-content: center; height: 460px; overflow: hidden; user-select: none; }
.gen-carousel-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; opacity: 0; transition: opacity .2s ease-out; cursor: zoom-in; }
.gen-carousel-stage img.loaded { opacity: 1; }
.gen-carousel-top { position: absolute; top: 12px; left: 14px; right: 14px; display: flex; align-items: center; justify-content: space-between; z-index: 5; pointer-events: none; gap: 8px; }
.gen-carousel-top > * { pointer-events: auto; }
.gen-carousel-badge-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gen-carousel-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #fff; color: var(--tx); border: 1px solid var(--bd); box-shadow: 0 2px 8px rgba(20, 22, 61, 0.08); }
.gen-carousel-badge.ai { background: var(--pl); color: var(--pr); border-color: #d7dcfd; }
.gen-carousel-badge.source { background: #e6f9f0; color: #0c8f69; border-color: #bbf0d8; }
.gen-carousel-counter { font-size: 12px; font-weight: 700; color: var(--mt); background: #fff; border: 1px solid var(--bd); padding: 4px 10px; border-radius: 99px; box-shadow: 0 2px 8px rgba(20, 22, 61, 0.06); }
.gen-carousel-top-actions { display: flex; gap: 6px; }
.gen-carousel-action-btn { display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--tx); border: 1px solid var(--bd); border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(20, 22, 61, 0.06); transition: all .15s; }
.gen-carousel-action-btn:hover { background: var(--pl); color: var(--pr); border-color: var(--pr); }
.gen-carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--tx); border: 1px solid var(--bd); display: grid; place-items: center; cursor: pointer; transition: all .15s; z-index: 4; box-shadow: 0 4px 14px rgba(20, 22, 61, 0.12); }
.gen-carousel-nav:hover { background: var(--pr); color: #fff; border-color: var(--pr); transform: translateY(-50%) scale(1.08); }
.gen-carousel-nav.prev { left: 14px; }
.gen-carousel-nav.next { right: 14px; }
.gen-carousel-nav:disabled { opacity: 0.25; cursor: not-allowed; transform: translateY(-50%) scale(1); }
.gen-carousel-thumbs { display: flex; gap: 10px; padding: 12px 14px; background: var(--sf); border-top: 1px solid var(--bd); overflow-x: auto; align-items: stretch; }
.gen-carousel-thumb { display: flex; flex-direction: column; gap: 5px; align-items: center; padding: 6px; border-radius: 10px; border: 2px solid transparent; background: var(--s2); cursor: pointer; transition: all .15s; flex: none; width: 112px; text-align: center; }
.gen-carousel-thumb:hover { background: var(--pl); border-color: #cfd3ff; }
.gen-carousel-thumb.on { background: var(--pl); border-color: var(--pr); box-shadow: 0 0 0 1px var(--pr); }
.gen-carousel-thumb-box { width: 100px; height: 68px; border-radius: 6px; overflow: hidden; background: #dfe1ea; display: flex; align-items: center; justify-content: center; position: relative; }
.gen-carousel-thumb-box img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .15s; }
.gen-carousel-thumb-box img.loaded { opacity: 1; }
.gen-carousel-thumb-label { font-size: 11.5px; font-weight: 600; color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.gen-carousel-thumb-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; }
.gen-carousel-thumb-tag.ai { background: var(--pl); color: var(--pr); }
.gen-carousel-thumb-tag.source { background: #e0f2fe; color: #0369a1; }

.customer-drawer .imgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.customer-drawer .imgs > div { aspect-ratio: 1/1; max-height: 340px; border-radius: 12px; overflow: hidden; position: relative; background: #e6e8f2; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .15s, box-shadow .15s; border: 1px solid var(--bd); }
.customer-drawer .imgs > div:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(20, 22, 61, 0.12); border-color: var(--pr); }
.customer-drawer .imgs img { width: 100%; height: 100%; object-fit: contain; display: block; opacity: 0; transition: opacity .15s; }
.customer-drawer .imgs img.loaded { opacity: 1; }
.customer-drawer .lb { position: absolute; left: 10px; bottom: 10px; background: rgba(20, 22, 61, .82); color: #fff; border-radius: 8px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; z-index: 2; backdrop-filter: blur(4px); }
.customer-drawer .box { background: var(--s2); border: 1px solid var(--bd); border-radius: 10px; padding: 12px 14px; margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--tx); }
.customer-drawer .box small { color: var(--mt); display: flex; justify-content: space-between; margin-bottom: 5px; font-weight: 600; font-size: 11.5px; }

.customer-drawer .sg { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.customer-drawer .sd { border: 1px solid var(--bd); border-radius: 12px; background: var(--sf); text-align: left; padding: 0; overflow: hidden; position: relative; cursor: pointer; transition: border-color .15s; }
.customer-drawer .sd:hover { border-color: var(--pr); }
.customer-drawer .sd.on { border: 2px solid var(--pr); }
.customer-drawer .sd .im { height: 110px; position: relative; background: #f8f9fd; border-bottom: 1px solid var(--bd); overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 6px; cursor: pointer; }
.customer-drawer .sd .im img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; opacity: 0; transition: opacity .15s; }
.customer-drawer .sd .im img.loaded { opacity: 1; }
.customer-drawer .sd .tx { padding: 8px 10px; }
.customer-drawer .sd b { display: block; font-size: 13px; color: var(--tx); }
.customer-drawer .sd small { color: var(--mt); font-size: 11px; }
.customer-drawer .st { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: #fff; color: var(--mt); display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.15); cursor: pointer; z-index: 2; }
.customer-drawer .st.on { background: var(--pr); color: #fff; }

.customer-drawer .sum { display: flex; gap: 20px; flex-wrap: wrap; color: var(--mt); font-size: 13px; }
.customer-drawer .sum b { color: var(--tx); }
.customer-drawer .pv { min-height: 280px; max-height: 520px; width: 100%; border-radius: 14px; overflow: hidden; position: relative; background: #f8f9fd; display: flex; align-items: center; justify-content: center; cursor: zoom-in; transition: border-color .15s, box-shadow .15s; border: 1px solid var(--bd); padding: 16px; box-sizing: border-box; }
.customer-drawer .pv:hover { border-color: var(--pr); box-shadow: 0 8px 24px rgba(79, 70, 229, 0.08); }
.customer-drawer .pv img { max-width: 100%; max-height: 480px; width: auto; height: auto; object-fit: contain; border-radius: 8px; box-shadow: 0 4px 18px rgba(20, 22, 61, 0.08); opacity: 0; transition: opacity .15s; }
.customer-drawer .pv img.loaded { opacity: 1; }
.pv-zoom-hint { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.94); color: var(--tx); border: 1px solid var(--bd); border-radius: 8px; padding: 5px 10px; font-size: 11.5px; font-weight: 600; backdrop-filter: blur(6px); box-shadow: 0 2px 8px rgba(20, 22, 61, 0.06); pointer-events: none; transition: all .15s; }
.customer-drawer .pv:hover .pv-zoom-hint { background: var(--pr); color: #fff; border-color: var(--pr); }

/* Fullscreen Carousel Lightbox Modal */
.carousel-modal { position: fixed; inset: 0; z-index: 250; background: rgba(10, 12, 28, 0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; flex-direction: column; color: #fff; animation: carousel-fade-in .15s ease-out; }
@keyframes carousel-fade-in { from { opacity: 0; transform: scale(.99); } to { opacity: 1; transform: scale(1); } }
.carousel-modal-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: rgba(18, 20, 44, 0.7); border-bottom: 1px solid rgba(255, 255, 255, 0.1); flex: none; }
.carousel-modal-info { display: flex; align-items: center; gap: 12px; }
.carousel-modal-tag { font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 99px; background: var(--pr); color: #fff; }
.carousel-modal-tag.source { background: #0ea5e9; }
.carousel-modal-tag.green { background: #16a34a; }
.carousel-modal-tag.blue { background: #2563eb; }
.carousel-modal-tag.neutral { background: #64748b; }
.carousel-modal-tag.ai { background: var(--pr); }
.carousel-modal-title { font-size: 16px; font-weight: 700; color: #fff; }
.carousel-modal-counter { font-size: 13px; color: rgba(255, 255, 255, 0.65); background: rgba(255, 255, 255, 0.1); padding: 3px 10px; border-radius: 99px; }
.carousel-modal-actions { display: flex; align-items: center; gap: 10px; }
.carousel-modal-action-btn { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); color: #fff; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; transition: all .15s; padding: 0; }
.carousel-modal-action-btn:hover { background: var(--pr); border-color: var(--pr); color: #fff; }
.carousel-modal-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; position: relative; }
.carousel-modal-img-wrap { flex: 1; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.carousel-modal-img-wrap img { max-width: 90vw; max-height: 72vh; object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity .18s ease-out; }
.carousel-modal-img-wrap img.loaded { opacity: 1; }
.carousel-nav-btn { width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.12); color: #fff; display: grid; place-items: center; cursor: pointer; transition: all .15s; flex: none; backdrop-filter: blur(6px); padding: 0; }
.carousel-nav-btn:hover { background: var(--pr); border-color: var(--pr); transform: scale(1.1); }
.carousel-nav-btn:disabled { opacity: 0.2; cursor: not-allowed; transform: scale(1); }
.carousel-modal-strip { flex: none; display: flex; gap: 10px; padding: 14px 24px; background: rgba(18, 20, 44, 0.85); border-top: 1px solid rgba(255, 255, 255, 0.1); overflow-x: auto; justify-content: center; }
.carousel-strip-item { width: 76px; height: 54px; border-radius: 6px; overflow: hidden; border: 2px solid transparent; cursor: pointer; opacity: 0.6; transition: all .15s; flex: none; background: #242845; display: flex; align-items: center; justify-content: center; padding: 2px; }
.carousel-strip-item:hover { opacity: 0.9; border-color: rgba(255, 255, 255, 0.5); }
.carousel-strip-item.on { opacity: 1; border-color: var(--pr); box-shadow: 0 0 0 2px var(--pr); }
.carousel-strip-item img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }

.customer-drawer .use { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--bd); font-size: 12.5px; }
.customer-drawer .use:last-child { border: 0; }
.customer-drawer table { width: 100%; border-collapse: collapse; min-width: 0; }
.customer-drawer th { text-align: left; color: var(--mt); font-weight: 600; font-size: 11.5px; padding: 8px 14px; background: var(--s2); border-bottom: 1px solid var(--bd); }
.customer-drawer td { padding: 10px 14px; border-top: 1px solid var(--bd); font-size: 12.5px; color: var(--tx); }
.customer-drawer .bar2 { height: 8px; border-radius: 9px; background: var(--pl); overflow: hidden; flex: 1; }
.customer-drawer .bar2 i { display: block; height: 100%; background: var(--pr); border-radius: 9px; }
.customer-drawer .sw { display: flex; gap: 12px; align-items: center; padding: 6px 0; font-size: 12.5px; }
.customer-drawer .sw i { width: 34px; height: 30px; border-radius: 6px; flex: none; }
.customer-drawer .tl { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--bd); font-size: 12.5px; }
.customer-drawer .tl:last-child { border: 0; }
.customer-drawer .tl .ib { border-radius: 50%; }

@media(max-width: 900px) {
  .drawer-backdrop { padding: 0; }
  .drawer-backdrop .customer-drawer { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: none; box-shadow: none; }
  .customer-drawer .wrap { flex-direction: column; overflow-y: auto; overflow-x: hidden; }
  .customer-drawer .rail { width: auto; overflow: visible; border: 0; border-bottom: 1px solid var(--bd); }
  .customer-drawer .main { overflow: visible; flex: none; width: 100%; max-width: 100%; min-width: 0; }
  .customer-drawer .tabs, #customer-tabs { position: sticky; top: 0; z-index: 5; padding: 0 12px; }
  .customer-drawer .pane, .customer-drawer .pane.ms { overflow: visible; padding: 14px; }
  .customer-drawer .md { display: block; }
  .customer-drawer .md > section { margin-bottom: 14px; }
  .customer-drawer .sc { overflow: visible; }
  .customer-drawer .g2, .customer-drawer .kv { grid-template-columns: 1fr; }
  .customer-drawer .acts { margin-top: 0; }
  .customer-drawer .imgs > div { max-height: 200px; }
}

.photo-refund-thumb { display: block; width: 74px; height: 98px; object-fit: cover; border-radius: 9px; background: #f2f2f7; }
.photo-refund-reason { max-width: 320px; white-space: normal; line-height: 1.45; }
.photo-refund-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.affiliate-settings { margin: 0 0 20px; padding: 0 18px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); box-shadow: var(--shadow); }
.affiliate-settings .panel-head { padding: 17px 0 14px; }
.affiliate-settings-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.affiliate-settings-fields label { display: grid; gap: 7px; color: #81869a; font-size: 10px; font-weight: 600; }
.affiliate-settings-fields label span { display: flex; align-items: center; gap: 8px; color: #81869a; }
.affiliate-settings-fields input, .affiliate-settings-fields select { width: 100%; height: 36px; border: 1px solid #e6e7ef; border-radius: 7px; padding: 0 10px; color: #3c4057; font-size: 12px; background: #fff; }
.affiliate-settings-help { margin: 12px 0 0; color: #8b8fa3; font-size: 10px; line-height: 1.55; }
@media (max-width: 700px) { .affiliate-settings { padding: 0 13px 14px; } .affiliate-settings .panel-head { align-items: flex-start; } .affiliate-settings-fields { grid-template-columns: 1fr; gap: 10px; } }

.affiliate-rate-cell { display: grid; gap: 3px; min-width: 122px; }
.affiliate-rate-cell strong { color: #45495f; font-size: 10px; white-space: nowrap; }
.affiliate-rate-cell span { color: #9296a9; font-size: 9px; white-space: nowrap; }
#affiliate-rows tr[data-affiliate-profile] { cursor: pointer; transition: background-color .15s ease; }
#affiliate-rows tr[data-affiliate-profile]:hover td { background: #f7f6ff; }
#affiliate-rows tr[data-affiliate-profile]:focus-visible { outline: 2px solid var(--pr); outline-offset: -2px; }
.affiliate-profile-backdrop { z-index: 95; }
.affiliate-profile-drawer .rail { width: 340px; }
.affiliate-profile-who { min-width: 0; }
.affiliate-profile-who h1 { overflow-wrap: anywhere; }
.affiliate-profile-who span { display: block; margin-top: 5px; color: var(--mt); font-size: 12px; overflow-wrap: anywhere; }
.affiliate-profile-drawer .fx dd { max-width: 155px; }
.affiliate-profile-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.affiliate-profile-page-head .eyebrow { color: #777d99; margin-bottom: 5px; }
.affiliate-profile-page-head h1 { margin: 0; color: var(--tx); font: 700 24px/1.2 Manrope, sans-serif; }
.affiliate-profile-page-head p { margin: 6px 0 0; color: var(--mt); font-size: 12px; }
.affiliate-profile-source { flex: none; padding: 6px 10px; border-radius: 99px; background: var(--pl); color: var(--pr); font-size: 11px; font-weight: 700; }
.affiliate-profile-card { padding: 18px; border: 1px solid var(--bd); border-radius: 12px; background: var(--sf); }
.affiliate-profile-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.affiliate-profile-card-head h2 { margin: 0; color: var(--tx); font: 700 15px Manrope, sans-serif; }
.affiliate-profile-card-head p { margin: 5px 0 0; color: var(--mt); font-size: 11px; }
.affiliate-profile-effective { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.affiliate-profile-effective > div { display: grid; gap: 6px; padding: 13px; border: 1px solid var(--bd); border-radius: 10px; background: var(--s2); }
.affiliate-profile-effective span { color: var(--mt); font-size: 11px; }
.affiliate-profile-effective strong { color: var(--tx); font: 700 18px Manrope, sans-serif; }
.affiliate-profile-form { margin: 0; }
.affiliate-profile-edit-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.affiliate-profile-edit-fields label { display: grid; align-content: start; gap: 7px; color: var(--mt); font-size: 11px; font-weight: 600; }
.affiliate-profile-edit-fields input, .affiliate-profile-edit-fields select { width: 100%; min-width: 0; height: 40px; padding: 0 11px; border: 1px solid var(--bd); border-radius: 9px; background: var(--sf); color: var(--tx); font-size: 13px; }
.affiliate-profile-edit-fields small { color: #858aa0; font-size: 10px; font-weight: 400; line-height: 1.45; }
.affiliate-profile-help { margin: 12px 0 0; color: var(--mt); font-size: 11px; line-height: 1.55; }
.affiliate-profile-error { margin-top: 12px; padding: 10px 12px; border: 1px solid #fbd0d5; border-radius: 9px; background: var(--rl); color: var(--rd); font-size: 12px; }
.affiliate-profile-form-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.affiliate-profile-form-actions .bt { min-width: 160px; }
.affiliate-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.affiliate-kpi-card { min-width: 0; padding: 15px 16px; border: 1px solid var(--bd); border-radius: 11px; background: var(--sf); }
.affiliate-kpi-card > span { display: block; color: var(--mt); font-size: 11px; }
.affiliate-kpi-card > strong { display: block; margin-top: 9px; color: var(--tx); font: 700 21px/1.25 Manrope, sans-serif; overflow-wrap: anywhere; }
.affiliate-kpi-card > small { display: block; margin-top: 5px; color: #858aa0; font-size: 10px; line-height: 1.45; }
.affiliate-kpi-recent { margin-top: 2px; }
.affiliate-kpi-list { display: grid; }
.affiliate-kpi-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--bd); }
.affiliate-kpi-row-main { min-width: 0; }
.affiliate-kpi-row-main strong, .affiliate-kpi-row-main span { display: block; overflow-wrap: anywhere; }
.affiliate-kpi-row-main strong { color: var(--tx); font-size: 12px; }
.affiliate-kpi-row-main span { margin-top: 4px; color: var(--mt); font-size: 10px; }
.affiliate-kpi-row-value { display: grid; justify-items: end; gap: 5px; flex: none; }
.affiliate-kpi-row-value > strong { color: var(--tx); font-size: 12px; }
.affiliate-kpi-empty { padding: 22px 0 4px; border-top: 1px solid var(--bd); color: var(--mt); font-size: 12px; text-align: center; }
@media (max-width: 900px) {
  .affiliate-profile-drawer .rail { width: auto; }
  .affiliate-profile-edit-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .affiliate-settings-fields select { height: 36px; }
  .affiliate-profile-page-head { align-items: flex-start; flex-direction: column; }
  .affiliate-profile-effective { grid-template-columns: 1fr; }
  .affiliate-profile-edit-fields { grid-template-columns: 1fr; }
  .affiliate-profile-card { padding: 15px; }
  .affiliate-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .affiliate-kpi-card { padding: 12px; }
  .affiliate-kpi-card > strong { font-size: 17px; }
  .affiliate-kpi-row { align-items: flex-start; gap: 10px; }
  .affiliate-kpi-row-value .badge { max-width: 145px; white-space: normal; text-align: right; }
}

/* Customer bulk actions toolbar & selection */
.customer-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  margin-bottom: 12px;
  background: #f4f3ff;
  border: 1px solid #dcd8fc;
  border-radius: 11px;
  box-shadow: 0 2px 8px rgba(86, 54, 255, 0.05);
}

.customer-bulk-info {
  font-size: 13px;
  font-weight: 700;
  color: #4338ca;
  display: flex;
  align-items: center;
  gap: 6px;
}

.customer-bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.customer-bulk-actions .button {
  height: 32px;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.th-cb, .td-cb {
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  text-align: center;
  padding: 6px 8px !important;
  vertical-align: middle;
}

.customer-select-cb, #customer-select-all {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary, #5636ff);
  margin: 0 auto;
  display: block;
}

.customer-table-row.selected {
  background: #f6f5ff !important;
}

.customer-table-row.selected:hover {
  background: #eeebff !important;
}
