:root{--bg:#08101c;--panel:#0e1827;--card:#132033;--line:#283a54;--text:#f4f7fb;--muted:#9bacbf;--blue:#70a7ff;--blue2:#377ee8;--green:#49d59a;--amber:#f5b84a;--red:#ff6f7d;--shadow:0 18px 50px rgba(0,0,0,.25)}
*{box-sizing:border-box}body{margin:0;background:radial-gradient(circle at 20% -10%,#17335b 0,transparent 35%),var(--bg);color:var(--text);font:15px/1.55 system-ui,-apple-system,"Segoe UI",sans-serif}button,input,textarea,select{font:inherit}button{cursor:pointer}.topbar{max-width:1280px;margin:auto;padding:34px 24px 20px;display:flex;align-items:flex-end;justify-content:space-between;gap:20px}.eyebrow,.step{margin:0 0 4px;color:var(--blue);font-weight:800;letter-spacing:.14em;font-size:12px}.topbar h1{margin:0;font-size:30px}.sub{margin:3px 0 0;color:var(--muted)}.health{display:flex;align-items:center;gap:9px;color:var(--muted)}.health span{width:10px;height:10px;border-radius:50%;background:var(--amber);box-shadow:0 0 16px currentColor}.health.ok span{background:var(--green)}.health.bad span{background:var(--red)}
.tabs{position:sticky;top:0;z-index:5;display:flex;gap:8px;max-width:1280px;margin:auto;padding:10px 24px;background:rgba(8,16,28,.92);backdrop-filter:blur(12px)}.tab{flex:1;border:1px solid var(--line);border-radius:12px;background:#0c1625;color:var(--muted);padding:12px;font-weight:800}.tab small{display:block;font-weight:500;margin-top:2px}.tab.active{background:linear-gradient(135deg,var(--blue2),#5a8ff2);border-color:transparent;color:white;box-shadow:var(--shadow)}main{max-width:1280px;margin:auto;padding:14px 24px 70px}.tab-panel{display:none}.tab-panel.active{display:block}.panel{padding-top:12px}.section-head{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:10px 0 18px}.section-head.compact{margin:0 0 14px}.section-head h2,.section-head h3{margin:0}.section-head p{margin:3px 0;color:var(--muted)}.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.card{background:linear-gradient(145deg,rgba(19,32,51,.96),rgba(13,24,39,.96));border:1px solid var(--line);border-radius:17px;padding:20px;margin-bottom:16px;box-shadow:var(--shadow)}.card.inner{margin:0;box-shadow:none}.card h3{margin:0 0 16px}.notice{border:1px solid #705421;background:#2c2512;color:#ffd984;border-radius:12px;padding:11px 14px;margin-bottom:16px}.notice.green{border-color:#276a52;background:#102a23;color:#8ee7c1}.price-grid,.settings-grid,.demand-input-grid{display:grid;grid-template-columns:1fr 1.45fr;gap:16px}.settings-grid,.demand-input-grid{grid-template-columns:1fr 1fr}.dropzone{min-height:300px;border:2px dashed #426188;border-radius:14px;display:grid;place-items:center;text-align:center;overflow:hidden;background:#0a1422;transition:.2s}.dropzone.drag{border-color:var(--blue);background:#102746}.dropzone b,.dropzone span{display:block}.dropzone b{font-size:20px;color:var(--blue)}.dropzone img{width:100%;height:300px;object-fit:contain}.choices{padding:13px 0}.choices label{display:flex;flex:0 0 auto;gap:6px;align-items:center;white-space:nowrap}.choices input[type="radio"]{width:auto;flex:0 0 auto;margin:0}label{display:grid;gap:6px;color:#cbd6e4;font-weight:650;margin-bottom:12px}input,textarea,select{width:100%;border:1px solid #334964;border-radius:9px;background:#091320;color:var(--text);padding:10px 11px;outline:none}input:focus,textarea:focus,select:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(112,167,255,.13)}button.primary,button.secondary,.view-buttons button{border-radius:10px;padding:10px 15px;font-weight:800}.primary{border:1px solid var(--blue);background:var(--blue);color:#07101d}.secondary,.view-buttons button{border:1px solid #435b79;background:#101d2f;color:var(--text)}.full{width:100%}button:disabled{opacity:.5;cursor:not-allowed}.status{min-height:20px;color:var(--muted);white-space:pre-wrap}.status.error{color:var(--red)}.status.success{color:var(--green)}.empty{border:1px dashed var(--line);border-radius:12px;padding:32px;text-align:center;color:var(--muted)}.identity-layout{display:grid;grid-template-columns:200px 1fr;gap:16px}.identity-layout img{width:200px;height:280px;object-fit:contain;border-radius:12px;background:#08111e}.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}.action-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.action-grid form{border:1px solid var(--line);border-radius:12px;padding:14px}.margin-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:10px;align-items:end}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;min-width:720px}th,td{text-align:left;border-bottom:1px solid var(--line);padding:11px 10px;vertical-align:top}th{color:var(--muted);font-size:12px}.badge{display:inline-block;padding:3px 8px;border-radius:999px;font-weight:800;font-size:12px}.badge.exact{background:#153c31;color:#7ee2b9}.badge.probable{background:#403315;color:#ffd36f}.badge.rejected{background:#451c25;color:#ff98a3}.badge.unresolved{background:#293447;color:#bdc7d5}.metric-row{display:flex;gap:10px;flex-wrap:wrap;margin:10px 0 16px}.metric{min-width:140px;border:1px solid var(--line);border-radius:12px;padding:11px 13px;background:#0b1625}.metric b{display:block;font-size:21px}.metric span{color:var(--muted);font-size:12px}.view-buttons{display:flex;gap:8px;overflow:auto;margin:16px 0}.view-buttons button.active{border-color:var(--blue);color:var(--blue)}.topic-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.topic{border:1px solid var(--line);border-radius:14px;background:var(--card);padding:16px}.topic h3{margin:6px 0}.topic .score{font-size:28px;font-weight:900;color:var(--blue)}.topic dl{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:12px 0}.topic dt{color:var(--muted)}.topic dd{margin:0;text-align:right}.topic details{border-top:1px solid var(--line);padding-top:10px}.topic a{color:var(--blue)}.consent{display:flex;grid-template-columns:auto 1fr;align-items:flex-start;gap:10px;padding:12px;border:1px solid #6a5226;border-radius:10px}.consent input{width:auto;margin-top:5px}.consent small{display:block;color:var(--muted);font-weight:400}.health-list>div{border:1px solid var(--line);border-radius:12px;padding:12px;margin-bottom:10px}.health-list .ok{color:var(--green)}.health-list .bad{color:var(--red)}.muted{color:var(--muted)}#toast{position:fixed;right:20px;bottom:20px;z-index:20;max-width:420px;padding:13px 17px;border-radius:12px;background:#eff6ff;color:#10203a;box-shadow:var(--shadow);transform:translateY(120px);opacity:0;transition:.25s}#toast.show{transform:none;opacity:1}a{color:var(--blue)}
.log-card{border-color:#355378}.log-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px}.log-head h3{margin:0}.log-summary{border:1px solid #355378;border-radius:10px;padding:10px 12px;margin-bottom:10px;background:#0a1728;color:#bcd3f5;white-space:pre-wrap}.log-summary.success{border-color:#276a52;color:#8ee7c1}.log-summary.error{border-color:#7a3141;color:#ff98a3}.activity-log{max-height:330px;overflow:auto;border:1px solid var(--line);border-radius:11px;background:#07111e}.log-empty{margin:0;padding:22px;text-align:center;color:var(--muted)}.log-entry{display:grid;grid-template-columns:82px 72px minmax(0,1fr);gap:10px;padding:10px 12px;border-bottom:1px solid #1d3048}.log-entry:last-child{border-bottom:0}.log-time{color:var(--muted);font-variant-numeric:tabular-nums}.log-level{width:max-content;height:max-content;padding:2px 7px;border-radius:999px;background:#293447;color:#bdc7d5;font-size:11px;font-weight:900}.log-entry.success .log-level{background:#153c31;color:#7ee2b9}.log-entry.error .log-level{background:#451c25;color:#ff98a3}.log-entry.running .log-level{background:#403315;color:#ffd36f}.log-message{min-width:0}.log-message b{display:block}.log-message small{display:block;color:var(--muted);white-space:pre-wrap;overflow-wrap:anywhere}.log-message details{margin-top:5px}.log-message summary{cursor:pointer;color:var(--blue)}.log-detail{margin:6px 0 0;padding:8px;border-radius:8px;background:#0c1a2c;color:#c8d5e5;white-space:pre-wrap;overflow-wrap:anywhere;font:12px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace}
.source-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px;margin:10px 0 16px}.source{display:grid;gap:3px;border:1px solid var(--line);border-radius:10px;padding:10px 12px;background:#0b1625}.source span,.source small{color:var(--muted);font-size:12px}.source.success{border-color:#276a52}.source.empty,.source.limited{border-color:#806129}.source.empty span,.source.empty small,.source.limited span,.source.limited small{color:var(--amber)}.source.failed{border-color:#7a3141}.source.failed span,.source.failed small{color:var(--red)}.source.unconfigured{opacity:.7}
.export-list{display:grid;gap:9px}.export-item{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid var(--line);border-radius:11px;padding:11px 12px;background:#0b1625}.export-item b,.export-item small{display:block}.export-item small{color:var(--muted);margin-top:2px}.export-item button{flex:0 0 auto}
@media(max-width:900px){.price-grid,.settings-grid,.demand-input-grid,.action-grid{grid-template-columns:1fr}.topic-grid{grid-template-columns:1fr 1fr}.margin-grid{grid-template-columns:repeat(3,1fr)}.identity-layout{grid-template-columns:1fr}.identity-layout img{width:100%;height:240px}.topbar{align-items:flex-start}.health{margin-top:8px}}
@media(max-width:600px){.topbar{padding:22px 15px 10px;display:block}.tabs{padding:8px 12px}.tab small{display:none}main{padding:10px 12px 50px}.section-head,.log-head{align-items:flex-start;flex-direction:column}.topic-grid{grid-template-columns:1fr}.field-grid{grid-template-columns:1fr}.margin-grid{grid-template-columns:1fr 1fr}.card{padding:15px}.dropzone{min-height:220px}.dropzone img{height:220px}.log-entry{grid-template-columns:70px 64px minmax(0,1fr);gap:7px;padding:9px}.log-head .row{width:100%}.log-head button{flex:1}}

/* Mobile-first finishing layer: every tab remains readable without page-level horizontal scrolling. */
.log-card.collapsed .activity-log{display:none}.log-actions{justify-content:flex-end}.token-row input{flex:1 1 280px}.token-row button{flex:0 0 auto}
@media(max-width:600px){
  body{font-size:14px;line-height:1.5;overflow-wrap:anywhere}
  .topbar{padding:18px 12px 9px}.topbar h1{font-size:27px;line-height:1.2}.topbar .sub{font-size:13px}.health{min-height:32px}
  .tabs{gap:5px;padding:7px 9px}.tab{min-width:0;min-height:48px;padding:9px 5px;font-size:14px;line-height:1.2;white-space:nowrap}
  main{padding:8px 10px 44px}.panel{padding-top:8px}.section-head{gap:12px;margin:8px 0 14px}.section-head h2{font-size:22px;line-height:1.35}.section-head h3{font-size:18px}.section-head p{font-size:13px}
  button.primary,button.secondary,.view-buttons button{min-height:44px;padding:10px 12px}
  .card{padding:14px;border-radius:14px;margin-bottom:12px}.card h3{font-size:18px;margin-bottom:12px}.notice{padding:10px 12px;margin-bottom:12px}
  .price-grid,.settings-grid,.demand-input-grid,.action-grid{gap:12px}.dropzone{min-height:210px}.dropzone img{height:210px}
  .choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 8px;padding:11px 0}.choices label{width:100%;min-height:36px;margin:0;padding:5px 3px}
  label{margin-bottom:10px}input,textarea,select{min-height:44px;padding:10px;font-size:16px}textarea{min-height:92px;resize:vertical}
  .identity-layout{gap:12px}.identity-layout img{height:210px}.field-grid{gap:0}.action-grid form{padding:12px}.action-grid form button{width:100%}
  .margin-grid{grid-template-columns:1fr 1fr;gap:8px}.margin-grid label{min-width:0}.margin-grid button{grid-column:1/-1;width:100%}
  .metric-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:8px 0 12px}.metric{min-width:0;padding:10px}.metric b{font-size:19px;overflow-wrap:anywhere}.metric span{font-size:11px}
  #demandTab>.section-head>.row{display:grid;grid-template-columns:1fr 1fr;width:100%;gap:8px}#demandTab>.section-head>.row button{width:100%;min-width:0}#analyzeBtn{grid-column:1/-1}
  .source-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.source{min-width:0;padding:9px}.source b,.source small,.source span{overflow-wrap:anywhere}
  .view-buttons{display:grid;grid-template-columns:1fr 1fr;gap:7px;overflow:visible;margin:12px 0}.view-buttons button{min-width:0;width:100%}.view-buttons button:last-child:nth-child(odd){grid-column:1/-1}
  .topic{padding:14px}.topic h3{font-size:18px}.topic dl{gap:5px 8px}.topic dd{overflow-wrap:anywhere}
  .log-card{padding:14px}.log-head{gap:9px;margin-bottom:9px}.log-head .log-actions{display:grid;grid-template-columns:1fr 1fr;width:100%;gap:7px}.log-head .log-actions button{width:100%;min-width:0;font-size:13px}.log-head .log-actions .log-toggle{grid-column:1/-1}.log-summary{padding:9px 10px;font-size:13px}.activity-log{max-height:280px;overflow-x:hidden}.log-entry{grid-template-columns:auto 1fr;gap:5px 9px;padding:10px}.log-time{font-size:12px}.log-level{justify-self:start}.log-message{grid-column:1/-1;width:100%;min-width:0}.log-message b,.log-message small{overflow-wrap:anywhere;word-break:break-word}.log-detail{max-width:100%;overflow-x:auto;font-size:11px}
  .token-row{display:grid;grid-template-columns:1fr;width:100%}.token-row input,.token-row button{width:100%;min-width:0}
  .export-item{align-items:stretch;flex-direction:column}.export-item button{width:100%}
  .table-wrap{overflow:visible}.mobile-card-table{min-width:0;width:100%}.mobile-card-table thead{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.mobile-card-table tbody,.mobile-card-table tr,.mobile-card-table td{display:block;width:100%}.mobile-card-table tr{border:1px solid var(--line);border-radius:11px;margin-bottom:10px;padding:7px 10px;background:#0b1625}.mobile-card-table td{display:grid;grid-template-columns:82px minmax(0,1fr);gap:8px;border-bottom:1px solid #1d3048;padding:8px 0;overflow-wrap:anywhere;word-break:break-word}.mobile-card-table td:last-child{border-bottom:0}.mobile-card-table td::before{content:attr(data-label);color:var(--muted);font-size:11px;font-weight:800}.mobile-card-table td[colspan]{grid-template-columns:1fr;text-align:center}.mobile-card-table td[colspan]::before{display:none}
}
@media(max-width:380px){
  .topbar h1{font-size:25px}.tabs{padding-inline:7px}.tab{font-size:13px;padding-inline:3px}.section-head h2{font-size:21px}
  .source-grid{grid-template-columns:1fr 1fr}.mobile-card-table td{grid-template-columns:72px minmax(0,1fr)}
}

/* Explicit mobile camera and gallery controls. */
.capture-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 10px}.capture-button{min-height:50px;width:100%;font-size:15px}.capture-button span{margin-right:4px}.permission-status{min-height:0;margin:0 0 10px;padding:9px 11px;border:1px solid #355378;border-radius:10px;background:#0a1728;color:#bcd3f5;font-size:13px}.permission-status.success{border-color:#276a52;color:#8ee7c1}.permission-status.error{border-color:#7a3141;color:#ff98a3}.dropzone{cursor:pointer}.dropzone:focus-visible{outline:3px solid rgba(112,167,255,.35);outline-offset:3px}.camera-help{margin:10px 0 4px;border:1px solid var(--line);border-radius:11px;background:#0a1422}.camera-help summary{cursor:pointer;padding:11px 12px;color:#cbd6e4;font-weight:800}.camera-help>div{padding:0 12px 12px;color:var(--muted);font-size:13px}.camera-help p{margin:8px 0}.camera-help b{color:var(--text)}.camera-help button{width:100%;margin-top:4px}
@media(max-width:600px){.capture-actions{gap:8px}.capture-button{min-height:52px;padding:9px 7px;font-size:14px}.permission-status{font-size:12px}.camera-help summary{min-height:44px}.camera-help>div{font-size:12px}}
@media(max-width:380px){.capture-actions{grid-template-columns:1fr}.capture-button{font-size:15px}}

/* Storage inventory and destructive controls. */
.storage-section{border-top:1px solid var(--line);padding:13px 0}.storage-section>summary{cursor:pointer;color:#dce7f5;font-weight:850;padding:5px 0 12px}.storage-section .table-wrap+.table-wrap{margin-top:12px}.storage-filters{align-items:center;margin-bottom:12px}.storage-filters select{width:auto;min-width:170px}.storage-pager{justify-content:center;align-items:center;margin-top:12px}.storage-pager span{min-width:150px;text-align:center}.storage-cleanup-row{align-items:end}.storage-cleanup-row select{flex:1 1 260px}.storage-cleanup-row label{display:flex;flex:0 0 auto;align-items:center;gap:7px;margin:0}.storage-cleanup-row input{width:100px}.danger-button{border-color:#8b3545!important;background:#351721!important;color:#ffb0b8!important}.storage-danger-zone{margin-top:16px;padding:16px;border:1px solid #8b3545;border-radius:12px;background:#25121a}.storage-danger-zone h3{color:#ff9ba6}.storage-danger-zone p{color:#ffc3c9}.storage-danger-zone input{flex:1 1 250px;border-color:#8b3545}.storage-file-actions{display:flex;gap:8px;flex-wrap:wrap}.storage-file-actions button,.storage-signal-delete{padding:7px 10px}.storage-title{max-width:460px;overflow-wrap:anywhere}.storage-title a{display:block;margin-top:4px;font-size:12px}.storage-metric-warning b{color:var(--amber)}
@media(max-width:600px){.storage-filters,.storage-cleanup-row,.storage-danger-zone>.row{display:grid;grid-template-columns:1fr;width:100%}.storage-filters select,.storage-cleanup-row select,.storage-cleanup-row label,.storage-cleanup-row input,.storage-filters button,.storage-cleanup-row button,.storage-danger-zone input,.storage-danger-zone button{width:100%}.storage-pager{display:grid;grid-template-columns:1fr auto 1fr}.storage-pager span{min-width:0}.storage-file-actions{display:grid;grid-template-columns:1fr}.storage-file-actions button{width:100%}}
