/* Package and subscription screens: explicit, independently versioned layout.
   Uses shared theme tokens; loaded after the older UI layers. */
html:root :is(.package-assign-shell,.ledger-dialog,.package-offer-card,.subscription-offer){box-sizing:border-box;min-width:0;color:var(--ink,#243446)}
html:root :is(.package-assign-shell,.ledger-dialog,.package-offer-card,.subscription-offer) *{box-sizing:border-box}

html:root .package-template-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr));gap:18px;align-items:stretch}
html:root .package-offer-card{position:relative;isolation:isolate;overflow:hidden;border:1px solid var(--line,#dfe7ee);border-radius:20px;background:var(--surface,#fff);box-shadow:0 4px 18px #172a3c05}
html:root .package-watermark{position:absolute;z-index:-1;right:-20px;top:56px;transform:rotate(-14deg);font-size:64px;line-height:1;font-weight:800;letter-spacing:-3px;white-space:nowrap;pointer-events:none;opacity:.035;color:var(--ink,#243446)}
html:root .package-offer-content{position:relative;display:flex;flex-direction:column;align-items:flex-start;gap:18px;padding:24px;min-height:100%;min-width:0}
html:root .package-type-label{display:inline-flex;align-items:center;gap:7px;padding:7px 10px;border-radius:9px;background:var(--surface-soft,#edf4fa);color:var(--muted,#627889);font-size:11px;font-weight:650;line-height:1.4}
html:root .package-type-label :is(svg,img){width:17px;height:17px;flex:none}
html:root .package-offer-card h2{margin:0;font-size:21px;line-height:1.3;overflow-wrap:anywhere}
html:root .package-offer-card h2 a{color:inherit;text-decoration:none}
html:root .package-offer-price{display:flex;flex-direction:column;gap:5px;font-size:25px;font-weight:750;letter-spacing:-.6px;line-height:1.2}
html:root .package-offer-price small{font-size:11px;letter-spacing:0;font-weight:400;color:var(--muted,#627889)}
html:root .package-offer-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;width:100%;padding:14px 0;border-top:1px solid var(--line,#dfe7ee);border-bottom:1px solid var(--line,#dfe7ee)}
html:root .package-offer-facts>span{display:flex;flex-direction:column;gap:5px;font-size:11px;line-height:1.5;color:var(--muted,#627889);min-width:0;overflow-wrap:anywhere}
html:root .package-offer-facts b{font-size:17px;color:var(--ink,#243446);font-weight:700}
html:root .package-offer-note{margin:0;font-size:12px;line-height:1.6;color:var(--muted,#627889)}
html:root .package-offer-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:auto;width:100%;padding-top:4px}
html:root .package-offer-actions>.button:first-child{grid-column:1/-1}
html:root .package-offer-actions>.button{width:100%;min-width:0;justify-content:center;min-height:44px;font-size:12px}

html:root #modal .package-assign-shell form{display:grid;gap:16px}
html:root #modal .package-assign-fields{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:12px}
html:root #modal .package-assign-fields .field{display:flex;flex-direction:column;gap:7px;min-width:0;margin:0;font-size:12px}
html:root #modal .package-assign-fields :is(input,select){display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0;min-height:44px;font-size:16px}
html:root #modal .package-assign-fields input::-webkit-date-and-time-value{min-width:0;text-align:left}
html:root #modal .package-assign-summary{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 12px;align-items:center;border:1px solid var(--line,#dfe7ee);border-radius:12px;padding:14px;background:var(--surface-soft,#f5f8fa)}
html:root #modal .package-assign-summary>.package-type-label{justify-self:start}
html:root #modal .package-assign-summary>b{font-size:18px;font-variant-numeric:tabular-nums}
html:root #modal .package-assign-summary>span:last-child{grid-column:1/-1;font-size:12px;line-height:1.5;color:var(--muted,#627889)}
html:root #modal .package-client-picker{margin:0;padding:0;border:0;min-width:0;display:grid;gap:12px}
html:root #modal .package-client-picker legend{padding:0;margin:0 0 10px;max-width:100%;font-size:13px;font-weight:650;line-height:1.5;color:var(--ink,#243446)}
html:root #modal .package-client-picker legend span{display:inline-block;margin-left:8px;border-radius:999px;padding:3px 8px;background:var(--surface-soft,#edf4fa);color:var(--muted,#627889);font-size:10px;font-weight:500}
html:root #modal .package-client-search{display:flex;align-items:center;gap:9px;padding:0 12px;margin:0;border:1px solid var(--line,#dfe7ee);border-radius:11px;background:var(--surface,#fff);min-width:0}
html:root #modal .package-client-search :is(svg,img){width:18px;height:18px;flex:0 0 18px;color:var(--muted,#627889)}
html:root #modal .package-client-search input{width:100%;min-width:0;min-height:44px;border:0;background:transparent;padding:10px 0;margin:0;box-shadow:none;font-size:16px;outline:0}
html:root #modal .package-client-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-height:260px;overflow:auto;overscroll-behavior:contain;padding:2px;min-width:0}
html:root #modal .package-client-option{display:flex;align-items:center;gap:10px;padding:11px 12px;min-height:44px;border:1px solid var(--line,#dfe7ee);border-radius:10px;background:var(--surface,#fff);margin:0;min-width:0;cursor:pointer}
html:root #modal .package-client-option input{appearance:auto;display:block;margin:0;padding:0;width:19px;height:19px;min-height:19px;max-width:19px;flex:0 0 19px;accent-color:var(--accent,#7190ac)}
html:root #modal .package-client-option span{font-size:13px;line-height:1.4;overflow-wrap:anywhere;min-width:0;color:var(--ink,#243446)}
html:root #modal .package-client-option:has(input:checked){background:var(--surface-soft,#edf4fa);border-color:var(--accent,#7190ac)}
html:root #modal .package-client-option[hidden],html:root #modal .package-client-empty[hidden]{display:none!important}
html:root #modal :is(.package-client-search,.package-client-option):focus-within{outline:2px solid var(--accent,#7190ac);outline-offset:2px}
html:root #modal :is(.package-client-empty,.package-assign-help){margin:0;font-size:11px;line-height:1.6;color:var(--muted,#627889)}
html:root #modal .package-assign-shell .modal-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:0}
html:root #modal .package-assign-shell .modal-actions .button{width:100%;min-width:0;justify-content:center;font-size:13px;min-height:44px}

html:root .ledger-dialog{display:grid;gap:16px}
html:root .ledger-summary{display:flex;align-items:center;gap:12px;padding:14px;border:1px solid var(--line,#dfe7ee);border-radius:13px;background:var(--surface-soft,#f5f8fa)}
html:root .ledger-summary .refine-icon{display:grid;place-items:center;flex:0 0 38px;width:38px;height:38px;background:var(--surface,#fff);border-radius:10px}
html:root .ledger-summary .refine-icon :is(svg,img){width:22px;height:22px}
html:root .ledger-summary h3{margin:0 0 5px;font-size:15px;line-height:1.4;overflow-wrap:anywhere}
html:root .ledger-summary small{font-size:12px;color:var(--muted,#627889)}
html:root .ledger-explanation{margin:0;font-size:11px;line-height:1.65;color:var(--muted,#627889)}
html:root .ledger-entries{display:grid;gap:8px;max-height:min(440px,50dvh);overflow:auto;overscroll-behavior:contain;padding:2px}
html:root .ledger-entry{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:13px;border:1px solid var(--line,#dfe7ee);border-radius:11px;background:var(--surface,#fff)}
html:root .ledger-entry>div{min-width:0}
html:root .ledger-entry h3{margin:0 0 5px;font-size:13px;line-height:1.4;overflow-wrap:anywhere}
html:root .ledger-entry small{font-size:11px;line-height:1.4;color:var(--muted,#627889)}
html:root .ledger-delta{display:flex;flex-direction:column;gap:3px;flex:0 0 54px;text-align:right;font-size:20px;font-variant-numeric:tabular-nums;line-height:1.2}
html:root .ledger-delta small{font-size:10px;font-weight:400}
html:root .ledger-delta.credit-added{color:#40705c}

html:root .commerce-panel .subscription-card-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr));gap:16px;margin:18px 0 8px;align-items:stretch}
html:root .commerce-panel .subscription-offer{display:flex;flex-direction:column;border:1px solid var(--line,#dfe7ee);border-radius:17px;background:var(--surface,#fff);overflow:hidden}
html:root .commerce-panel .subscription-offer.is-current{border-color:var(--accent,#7190ac)}
html:root .subscription-offer-body{display:flex;flex-direction:column;gap:13px;padding:20px;flex:1;min-width:0}
html:root .subscription-offer-top{display:flex;align-items:center;justify-content:space-between;gap:12px}
html:root .subscription-logo{position:relative;display:grid;place-items:center;flex:0 0 52px;width:52px;height:52px;overflow:hidden;border-radius:12px;border:1px solid var(--line,#dfe7ee);background:var(--surface-soft,#edf4fa);color:var(--ink,#243446);box-shadow:none}
html:root .subscription-logo>svg{position:absolute;inset:0;width:100%;height:100%}
html:root .subscription-logo b{font-size:14px;line-height:1}
html:root .subscription-logo img{display:block;width:100%;height:100%;max-width:100%;object-fit:contain;filter:none!important}
html:root .subscription-state{padding:6px 9px;border:1px solid var(--line,#dfe7ee);border-radius:999px;background:var(--surface-soft,#f5f8fa);color:var(--muted,#627889);font-size:10px;line-height:1.4;text-align:center;max-width:65%;overflow-wrap:anywhere}
html:root .commerce-panel .subscription-offer h3{margin:0;font-size:21px;line-height:1.3;overflow-wrap:anywhere;color:var(--ink,#243446)}
html:root .commerce-panel .subscription-description{margin:0;font-size:12px;line-height:1.65;color:var(--muted,#627889);overflow-wrap:anywhere}
html:root .subscription-features{display:grid;gap:8px;padding:0;margin:2px 0 0;list-style:none;font-size:12px;line-height:1.5}
html:root .subscription-features li{display:flex;align-items:flex-start;gap:8px;min-width:0;overflow-wrap:anywhere}
html:root .subscription-features li>span{flex:none;color:var(--muted,#627889)}
html:root .subscription-offer-footer{display:grid;grid-template-columns:minmax(0,1fr);gap:14px;padding:18px 20px;border-top:1px solid var(--line,#dfe7ee);background:var(--surface-soft,#f5f8fa)}
html:root .subscription-price{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
html:root .subscription-price strong{font-size:27px;line-height:1.2;font-weight:750;color:var(--ink,#243446);letter-spacing:-.6px}
html:root .subscription-price>span{font-size:11px;color:var(--muted,#627889)}
html:root .commerce-panel .subscription-subscribe{width:100%;min-width:0;justify-content:center;min-height:44px;font-size:13px;border-radius:11px}
html:root .subscription-switch-note{font-size:10px;line-height:1.5;color:var(--muted,#627889);text-align:center;min-height:0}
html:root .subscription-switch-note:empty{display:none}
html:root[data-theme=midnight] .ledger-delta.credit-added{color:var(--night-ink,#fff)}

@media(max-width:700px){
 html:root .page-header-actions:has(.package-header-actions){width:100%;max-width:none}
 html:root .package-header-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:100%}
 html:root .package-header-actions>.button{display:inline-flex;align-items:center;justify-content:center;gap:7px;width:100%;min-width:0;min-height:46px;font-size:12px;padding:10px;white-space:normal;line-height:1.3}
 html:root .package-header-actions>.button:first-child{grid-column:1/-1}
 html:root .package-header-actions>.button:last-child{grid-column:auto}
 html:root .package-header-actions .action-icon-tile{width:28px;height:28px;flex-basis:28px}
 html:root .package-command-bar{gap:12px;margin-bottom:16px}
 html:root .package-tabs{display:grid;width:100%;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;padding:4px;margin:0}
 html:root .package-tab{gap:6px;padding:10px 7px;min-width:0;min-height:58px;font-size:11px}
 html:root .package-tab>span{white-space:normal;text-overflow:clip;overflow:visible;line-height:1.3}
 html:root .package-tab :is(svg,img){width:18px;height:18px;flex:none}
 html:root .package-tab small{font-size:10px;flex:none;padding:4px 6px;min-width:22px}
 html:root .package-command-bar .package-type-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:7px}
 html:root .package-command-bar .package-filter-badge{display:flex;justify-content:space-between;align-items:center;gap:6px;min-width:0;min-height:38px;margin:0;font-size:11px;padding:7px 10px}
 html:root .package-template-grid{grid-template-columns:1fr;gap:14px}
 html:root .package-offer-content{padding:20px;gap:16px}
 html:root .package-watermark{font-size:58px;top:60px;right:-16px}
 html:root #modal .package-assign-fields{grid-template-columns:1fr;gap:14px}
 html:root #modal .package-client-options{grid-template-columns:1fr;max-height:240px}
 html:root #modal .package-assign-shell .modal-actions{padding-inline:0}
 html:root .commerce-panel .subscription-card-grid{grid-template-columns:1fr;gap:13px}
 html:root .commerce-panel>.commerce-section{padding:16px}
 html:root .commerce-panel .commerce-heading{display:flex;flex-direction:column;align-items:flex-start;gap:10px;margin-bottom:14px}
 html:root .commerce-panel .commerce-heading h3{font-size:16px;line-height:1.4}
 html:root .commerce-panel .commerce-heading p{font-size:12px;line-height:1.6}
 html:root .commerce-panel .commerce-heading>.button{width:100%;min-height:44px;justify-content:center}
 html:root .subscription-offer-body{padding:17px;gap:12px}
 html:root .subscription-offer-footer{padding:16px 17px}
 html:root .commerce-panel .subscription-offer h3{font-size:20px}
 html:root .ledger-entry{padding:12px}
}
