:root {
    --bg: #f6f7f9;
    --card: #ffffff;
    --text: #1a1f2b;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --approve: #16a34a;
    --reject:  #dc2626;
    --pending: #9ca3af;
    --warn: #b45309;
    --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
.centered  { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    width: 100%;
    max-width: 420px;
}
.card h1 { margin: 0 0 16px; font-size: 1.4rem; }

label { display: block; margin: 12px 0; font-weight: 500; }
label input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
    background: #fff; color: var(--text); }
label input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; color: var(--text);
    border: 1px solid var(--line); border-radius: 8px;
    padding: 8px 14px; font-size: 14px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: #f3f4f6; }
.btn:disabled, .btn.disabled, .btn[aria-disabled="true"] {
    opacity: .5; cursor: not-allowed; pointer-events: none;
}
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--reject); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; border-color: var(--reject); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.link, button.link {
    background: none; border: none; padding: 0; color: var(--primary);
    cursor: pointer; text-decoration: underline; font: inherit;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 1200px; margin: 0 auto;
    padding: 12px 20px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
}
.topbar nav a { margin-left: 16px; color: var(--muted); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }

.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.row-between h1 { margin: 0 0 8px; font-size: 1.6rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--reject); }
.success { color: var(--approve); }
.warn { color: var(--warn); }

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-top: 16px; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: #fafbfc; font-size: 13px; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }

.progress {
    width: 160px; height: 8px; background: #eef0f3; border-radius: 99px; overflow: hidden;
    display: flex; margin-bottom: 4px;
}
.bar { height: 100%; }
.bar.approved { background: var(--approve); }
.bar.rejected { background: var(--reject); }

.pill {
    display: inline-block; padding: 2px 10px; border-radius: 99px;
    font-size: 12px; font-weight: 600;
    background: #eef0f3; color: var(--muted);
    margin-left: 4px;
}
.pill.open   { background: #dcfce7; color: #166534; }
.pill.closed { background: #fee2e2; color: #991b1b; }

.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    background: #fff;
    padding: 28px;
    text-align: center;
    margin: 24px 0;
    transition: border-color .12s, background .12s;
}
.dropzone.drag { border-color: var(--primary); background: #eff6ff; }
.dropzone p { margin: 6px 0; }

.upload-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; }
.upload-item {
    display: grid; grid-template-columns: 1fr 200px auto; align-items: center; gap: 12px;
    padding: 8px 12px; background: #f3f4f6; border-radius: 8px; font-size: 13px;
}
.upload-meta { display: flex; flex-direction: column; }
.upload-meta .filename { font-weight: 500; word-break: break-all; }
.upload-meta .size { color: var(--muted); font-size: 11.5px; }
.upload-item .bar { height: 6px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.upload-item .bar-fill { height: 100%; width: 0; background: var(--primary); transition: width .12s; }
.upload-item.ok .bar-fill { background: var(--approve); }
.upload-item.err .bar-fill { background: var(--reject); }
.upload-item .status { color: var(--muted); font-size: 12px; }

.grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.grid-empty { grid-column: 1 / -1; margin: 0; }

.tile {
    position: relative;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column;
    transition: transform .12s, box-shadow .12s;
}
.tile:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 8px 18px rgba(0,0,0,.06); }
.tile-media {
    aspect-ratio: 4 / 3;
    background: #1f2937;
    position: relative;
    cursor: zoom-in;
    overflow: hidden;
}
.tile-media img, .tile-media video {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.play-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 36px; text-shadow: 0 2px 6px rgba(0,0,0,.4);
    pointer-events: none;
}

.tile-badge {
    position: absolute; top: 8px; right: 8px;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--pending);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.tile.decision-approved .tile-badge { background: var(--approve); }
.tile.decision-approved .tile-badge::after { content: '✓'; }
.tile.decision-rejected .tile-badge { background: var(--reject); }
.tile.decision-rejected .tile-badge::after { content: '✕'; }
.tile.decision-pending  .tile-badge::after { content: '?'; }

.tile.decision-approved { outline: 2px solid var(--approve); outline-offset: -2px; }
.tile.decision-rejected { outline: 2px solid var(--reject);  outline-offset: -2px; }

.tile-actions, .tile-decide {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
}
.tile-actions { justify-content: flex-end; }
.btn-icon {
    border: none; background: transparent; cursor: pointer; padding: 4px 8px;
    color: var(--muted); border-radius: 6px; font-size: 14px;
    text-decoration: none; display: inline-flex; align-items: center;
}
.btn-icon:hover { background: #f3f4f6; color: var(--text); text-decoration: none; }

.btn-decide {
    flex: 1; border: none; padding: 8px 10px; border-radius: 6px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    background: #fff; border: 1px solid var(--line); color: var(--text);
}
.btn-decide.approve:hover { background: #ecfdf5; border-color: var(--approve); color: var(--approve); }
.btn-decide.reject:hover  { background: #fef2f2; border-color: var(--reject);  color: var(--reject); }
.tile.decision-approved .btn-decide.approve { background: var(--approve); color: #fff; border-color: var(--approve); }
.tile.decision-rejected .btn-decide.reject  { background: var(--reject);  color: #fff; border-color: var(--reject); }

.dialog {
    border: none; padding: 0; border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
    max-width: 480px; width: 90vw;
}
.dialog::backdrop { background: rgba(15, 23, 42, .4); }
.dialog form { padding: 24px; }
.dialog h2 { margin: 0 0 12px; font-size: 1.2rem; }
.dialog menu { display: flex; gap: 8px; justify-content: flex-end; margin: 16px 0 0; padding: 0; }
.choice-list { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.choice-list label { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: start; cursor: pointer; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-weight: normal; margin: 0; }
.choice-list label:has(input:checked) { border-color: var(--primary); background: #eff6ff; }
.choice-list label input { grid-row: span 2; margin-top: 4px; width: auto; }
.choice-list label strong { display: block; }

.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: #111827; color: #fff;
    padding: 10px 18px; border-radius: 99px;
    font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
    z-index: 1100;
    max-width: 90vw;
}
.toast.ok    { background: var(--approve); }
.toast.error { background: var(--reject); }

.banner {
    background: #fef3c7; color: #78350f;
    border: 1px solid #fde68a;
    padding: 12px 16px; border-radius: 8px;
    margin: 16px 0;
}

.tile.decision-rejected .tile-media img,
.tile.decision-rejected .tile-media video { filter: grayscale(1); transition: filter .2s; }

body.client .tile-badge { display: none; }
body.client .tile.decision-approved,
body.client .tile.decision-rejected { outline: none; }

.client-header { background: #fff; border-bottom: 1px solid var(--line); }
.client-title { margin: 0; font-size: 1.4rem; }
.counters { margin: 4px 0 0; display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.counter strong { color: var(--text); }
.counter.approved strong { color: var(--approve); }
.counter.rejected strong { color: var(--reject); }

.hint { margin: 8px 0; }
kbd {
    display: inline-block; padding: 1px 6px; border: 1px solid var(--line);
    border-bottom-width: 2px; border-radius: 4px; background: #f9fafb;
    font: 600 11px/1.4 ui-monospace, Menlo, monospace;
}

.lightbox {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .92);
    z-index: 1000;
    display: flex; flex-direction: column;
    padding: 16px;
}
.lightbox[hidden] { display: none; }
.lb-stage {
    flex: 1; display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.lb-stage img, .lb-stage video {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    background: #000;
    border-radius: 6px;
}
.lb-close, .lb-prev, .lb-next {
    position: absolute;
    background: rgba(255,255,255,.1); color: #fff;
    border: none; border-radius: 50%;
    width: 44px; height: 44px;
    font-size: 22px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 1;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.2); }
.lb-close { top: 16px; right: 16px; }
.lb-prev  { top: 50%; left: 16px; transform: translateY(-50%); }
.lb-next  { top: 50%; right: 16px; transform: translateY(-50%); }
.lb-info {
    color: rgba(255,255,255,.85);
    text-align: center; padding: 8px 0;
    display: flex; gap: 12px; justify-content: center; align-items: center;
    font-size: 14px;
}
.lb-count { color: rgba(255,255,255,.6); font-size: 12.5px; }
.lb-actions { display: flex; gap: 12px; justify-content: center; padding-bottom: 8px; }
.btn-decide.big {
    flex: 0 0 auto;
    padding: 12px 28px; font-size: 15px;
    border: 2px solid rgba(255,255,255,.3);
    background: rgba(255,255,255,.05); color: #fff;
}
.btn-decide.big.approve:hover { background: var(--approve); border-color: var(--approve); color: #fff; }
.btn-decide.big.reject:hover  { background: var(--reject);  border-color: var(--reject);  color: #fff; }
.lightbox.decision-approved .btn-decide.big.approve { background: var(--approve); border-color: var(--approve); color: #fff; }
.lightbox.decision-rejected .btn-decide.big.reject  { background: var(--reject);  border-color: var(--reject);  color: #fff; }
.btn-decide.big:active { transform: scale(.96); }

@media (max-width: 600px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .container { padding: 16px 12px; }
    .table { font-size: 13px; }
    .table th, .table td { padding: 8px; }
    .progress { width: 100px; }
    .lb-close, .lb-prev, .lb-next { width: 38px; height: 38px; font-size: 18px; }
}
