*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --acc:    #1D9E75;
  --acc2:   #0F6E56;
  --acc3:   #085041;
  --alight: #E1F5EE;
  --amid:   #5DCAA5;
  --danger: #E24B4A;
  --dlight: #FCEBEB;
  --info:   #185FA5;
  --ilight: #E6F1FB;
  --warn:   #BA7517;
  --wlight: #FAEEDA;
  --bg:     #ffffff;
  --bg2:    #f7f7f5;
  --bg3:    #f0efed;
  --txt:    #1a1a18;
  --txt2:   #666660;
  --txt3:   #999994;
  --brd:    rgba(0,0,0,.12);
  --brd2:   rgba(0,0,0,.22);
  --r:      8px;
  --rl:     12px;
  --font:   system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:   'SF Mono', 'Fira Code', 'Consolas', monospace;
}

body { font-family: var(--font); font-size: 14px; color: var(--txt); background: var(--bg3); }

/* ── LAYOUT ── */
.app     { min-height: 100vh; display: flex; flex-direction: column; }
.topbar  { display: flex; align-items: center; gap: 10px; padding: 11px 20px; background: var(--bg); border-bottom: 0.5px solid var(--brd); }
.logo-mk { width: 28px; height: 28px; border-radius: 6px; background: var(--acc); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-mk svg { width: 16px; height: 16px; fill: white; }
.logo-nm { font-size: 15px; font-weight: 600; color: var(--txt); }
.spacer  { flex: 1; }
.user-pill { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: var(--r); border: 0.5px solid var(--brd); background: var(--bg2); cursor: default; }
.avatar  { width: 26px; height: 26px; border-radius: 50%; background: var(--alight); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--acc3); }
.u-name  { font-size: 13px; font-weight: 500; }
.u-role  { font-size: 11px; color: var(--txt3); }
.btn-logout { font-size: 12px; color: var(--danger); background: none; border: none; cursor: pointer; padding: 2px 6px; border-radius: 4px; margin-left: 4px; }
.btn-logout:hover { background: var(--dlight); }

/* ── NAV TABS ── */
.nav { display: flex; gap: 2px; padding: 0 20px; background: var(--bg); border-bottom: 0.5px solid var(--brd); }
.nav-btn { padding: 10px 14px; font-size: 13px; color: var(--txt2); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -0.5px; transition: color .15s, border-color .15s; }
.nav-btn:hover { color: var(--txt); }
.nav-btn.active { color: var(--acc); border-bottom-color: var(--acc); font-weight: 500; }

/* ── CONTENT ── */
.content { flex: 1; padding: 24px 20px; max-width: 860px; margin: 0 auto; width: 100%; }

/* ── CARDS ── */
.card { background: var(--bg); border: 0.5px solid var(--brd); border-radius: var(--rl); padding: 16px 18px; margin-bottom: 16px; }
.card-title { font-size: 13px; font-weight: 500; color: var(--txt); margin-bottom: 12px; }
.section-lbl { font-size: 11px; font-weight: 500; color: var(--txt3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; }

/* ── FORMS ── */
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 12px; color: var(--txt2); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 0.5px solid var(--brd2);
  border-radius: var(--r); font-size: 13px; font-family: var(--font);
  color: var(--txt); background: var(--bg); outline: none; }
.field input:focus, .field select:focus { border-color: var(--acc); box-shadow: 0 0 0 2px rgba(29,158,117,.15); }
.field input[type=password] { letter-spacing: 2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ── BUTTONS ── */
.btn        { padding: 8px 16px; border-radius: var(--r); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: background .15s, opacity .15s; }
.btn-acc    { background: var(--acc); color: white; }
.btn-acc:hover { background: var(--acc2); }
.btn-out    { background: var(--bg); color: var(--txt); border: 0.5px solid var(--brd2); }
.btn-out:hover { background: var(--bg2); }
.btn-danger { background: var(--dlight); color: var(--danger); border: 0.5px solid var(--danger); }
.btn-danger:hover { background: #f7c1c1; }
.btn-full   { width: 100%; padding: 11px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── PROVIDER GRID ── */
.prov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prov-card { padding: 10px 12px; border: 0.5px solid var(--brd); border-radius: var(--r); cursor: pointer; transition: border-color .15s; }
.prov-card:hover { border-color: var(--acc); }
.prov-card.active { border: 1.5px solid var(--acc); background: var(--alight); }
.prov-card .pn { font-size: 13px; font-weight: 500; }
.prov-card.active .pn { color: var(--acc3); }
.prov-card .pd { font-size: 11px; color: var(--txt3); }
.settings-box { background: var(--bg2); border-radius: var(--r); border: 0.5px solid var(--brd); padding: 12px 14px; margin-top: 10px; }

/* ── DROPZONE ── */
.dropzone { border: 1.5px dashed var(--brd2); border-radius: var(--rl); padding: 2rem; text-align: center; cursor: pointer; transition: all .2s; position: relative; }
.dropzone:hover, .dropzone.drag { border-color: var(--acc); background: var(--alight); }
#fileInput { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-icon svg { width: 36px; height: 36px; color: var(--txt3); margin-bottom: 10px; }
.dz-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.dz-sub   { font-size: 12px; color: var(--txt2); }
.dz-link  { color: var(--acc); }

/* ── FILE INFO ── */
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg2); border: 0.5px solid var(--brd); border-radius: var(--r); margin-top: 8px; }
.ficon    { width: 32px; height: 32px; background: var(--alight); border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ficon svg { width: 16px; height: 16px; fill: var(--acc); }
.fname    { font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsize    { font-size: 11px; color: var(--txt3); }
.fremove  { background: none; border: none; font-size: 14px; cursor: pointer; color: var(--txt3); padding: 4px; border-radius: 4px; }
.fremove:hover { color: var(--danger); }

/* ── PROGRESS ── */
.prog-bg   { background: var(--bg3); border-radius: 99px; height: 4px; overflow: hidden; margin: 8px 0 4px; }
.prog-fill { height: 100%; background: var(--acc); border-radius: 99px; transition: width .3s; }
.prog-info { display: flex; justify-content: space-between; font-size: 11px; color: var(--txt2); }
.prog-status { font-size: 11px; color: var(--txt3); margin-top: 3px; font-style: italic; }
.log-box { margin-top: 8px; background: var(--bg3); border: 0.5px solid var(--brd); border-radius: var(--r); padding: 8px 10px; font-family: var(--mono); font-size: 11px; color: var(--txt2); max-height: 110px; overflow-y: auto; line-height: 1.9; }
.lg-ok   { color: var(--acc); }
.lg-err  { color: var(--danger); }
.lg-warn { color: var(--warn); }
.lg-inf  { color: var(--info); }

/* ── DOWNLOAD CARD ── */
.dl-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--alight); border: 1px solid var(--amid); border-radius: var(--rl); margin-top: 10px; }
.dl-info .dl-name { font-size: 13px; font-weight: 500; color: var(--acc3); }
.dl-info .dl-meta { font-size: 11px; color: var(--acc2); }

/* ── TABLES ── */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 500; color: var(--txt3); text-transform: uppercase; letter-spacing: .06em; border-bottom: 0.5px solid var(--brd); }
.tbl td { padding: 10px 12px; border-bottom: 0.5px solid var(--brd); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--bg2); }
.tbl-actions { display: flex; gap: 6px; }
.btn-xs { padding: 4px 9px; font-size: 12px; border-radius: 5px; cursor: pointer; border: 0.5px solid var(--brd2); background: var(--bg); color: var(--txt); }
.btn-xs:hover { background: var(--bg2); }
.btn-xs.del { color: var(--danger); border-color: var(--danger); }
.btn-xs.del:hover { background: var(--dlight); }

/* ── BADGES ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 500; }
.b-green  { background: var(--alight); color: var(--acc3); }
.b-gray   { background: var(--bg3);    color: var(--txt2); }
.b-blue   { background: var(--ilight); color: #0C447C; }
.b-amber  { background: var(--wlight); color: #633806; }
.b-red    { background: var(--dlight); color: #791F1F; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--bg); border-radius: var(--rl); border: 0.5px solid var(--brd); padding: 24px; width: 380px; max-width: 95vw; }
.modal-title { font-size: 16px; font-weight: 500; margin-bottom: 16px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ── PAGE HEADER ── */
.ph { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.ph-title { font-size: 18px; font-weight: 500; }

/* ── STATS ROW ── */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--bg2); border-radius: var(--r); padding: 14px 16px; }
.stat-lbl  { font-size: 12px; color: var(--txt2); margin-bottom: 4px; }
.stat-val  { font-size: 22px; font-weight: 500; }
.stat-sub  { font-size: 11px; color: var(--txt3); margin-top: 2px; }

/* ── TOGGLE ── */
.tog-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 36px; height: 20px; border-radius: 10px; border: none; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.toggle.off { background: var(--bg3); border: 0.5px solid var(--brd2); }
.toggle.on  { background: var(--acc); }
.toggle::after { content:''; position: absolute; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: left .2s; }
.toggle.off::after { left: 2px; }
.toggle.on::after  { left: 18px; }

/* ── API CARD ── */
.api-card { background: var(--bg); border: 0.5px solid var(--brd); border-radius: var(--rl); padding: 16px 18px; margin-bottom: 12px; }
.api-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.api-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.api-dot.on  { background: var(--acc); }
.api-dot.off { background: var(--bg3); border: 1px solid var(--brd2); }
.api-name { font-size: 14px; font-weight: 500; flex: 1; }

/* ── LOGIN ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg3); }
.login-card { width: 360px; background: var(--bg); border: 0.5px solid var(--brd); border-radius: var(--rl); padding: 32px 28px; }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-err  { padding: 8px 12px; background: var(--dlight); color: var(--danger); border-radius: var(--r); font-size: 12px; margin-bottom: 12px; display: none; }
.login-hint { margin-top: 14px; font-size: 12px; color: var(--txt3); text-align: center; line-height: 1.7; }

/* ── MISC ── */
.hidden  { display: none !important; }
.mt8     { margin-top: 8px; }
.mt16    { margin-top: 16px; }
.spin    { animation: sp 1s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.alert-ok { padding: 8px 12px; background: var(--alight); color: var(--acc3); border-radius: var(--r); font-size: 13px; }
.alert-err { padding: 8px 12px; background: var(--dlight); color: var(--danger); border-radius: var(--r); font-size: 13px; }
