:root {
  --bg: #0b0f0d; --panel: #121815; --panel2: #18201c; --line: #243029; --text: #e7efe9; --muted: #8fa198;
  --accent: #22c55e; --accent2: #16a34a; --warn: #f59e0b; --bad: #ef4444; --info: #38bdf8;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 5px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel2);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04130a; font-weight: 600; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.layout { display: flex; min-height: 100vh; }
.side { width: 210px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 17px; margin: 2px 8px 16px; display: flex; gap: 8px; align-items: center; }
.brand i { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: inline-block; }
.nav { padding: 8px 10px; border-radius: 8px; color: var(--text); cursor: pointer; }
.nav:hover { background: var(--panel2); }
.nav.on { background: var(--panel2); color: var(--accent); }
.side .me { margin-top: auto; font-size: 12.5px; color: var(--muted); padding: 8px; border-top: 1px solid var(--line); }
.main { flex: 1; padding: 22px 26px; min-width: 0; }
h1 { font-size: 21px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 22px 0 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.hidden { display: none !important; }

.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.job { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; }
.job:hover { border-color: var(--accent); }
.job .cov { aspect-ratio: 16/9; background: var(--panel2) center/cover; }
.job .b { padding: 10px 12px; }
.job .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; border: 1px solid var(--line); }
.pill.running, .pill.queued, .pill.writing { color: var(--info); border-color: var(--info); }
.pill.done { color: var(--accent); border-color: var(--accent); }
.pill.partial, .pill.paused { color: var(--warn); border-color: var(--warn); }
.pill.failed { color: var(--bad); border-color: var(--bad); }
.bar { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > div { height: 100%; background: var(--accent); transition: width .4s; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; position: relative; }
.tile .im { background: var(--panel2) center/cover; cursor: zoom-in; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.tile .im.landscape { aspect-ratio: 16/9; } .tile .im.portrait { aspect-ratio: 9/16; } .tile .im.square { aspect-ratio: 1; }
.tile .cap { padding: 6px 8px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.tile .cap span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.tile .n { position: absolute; top: 6px; left: 6px; background: #000a; padding: 0 6px; border-radius: 5px; font-size: 11.5px; }
.tile.failed { border-color: var(--bad); }
.tile.pending .im::after { content: "intezar…"; }
.tile.busy .im::after { content: "ban rahi hai…"; color: var(--info); }

.log { font: 12px/1.55 ui-monospace, Consolas, monospace; background: #070a08; border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 240px; overflow: auto; white-space: pre-wrap; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; }

.auth { max-width: 360px; margin: 12vh auto; }
.modal { position: fixed; inset: 0; background: #000c; display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; max-width: min(1100px, 96vw); max-height: 94vh; overflow: auto; position: relative; }
.modal-x { position: absolute; top: 6px; right: 10px; background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); }
.modal img { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto 10px; border-radius: 8px; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 9px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.err { border-color: var(--bad); color: #fecaca; }
.stat { display: flex; gap: 22px; flex-wrap: wrap; }
.stat div b { display: block; font-size: 20px; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 10px 16px; }
  .brand { margin: 0 10px 0 0; }
  .side .me { margin: 0; border: 0; }
  .main { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
