:root {
    --bg: #f4f7fb;
    --card: #fff;
    --text: #172033;
    --muted: #667085;
    --border: #e4e7ec;
    --primary: #0f766e;
    --primary2: #115e59;
    --danger: #b42318;
    --success: #027a48;
    --shadow: 0 18px 48px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Cairo', Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top right, #eaf7f5 0, #f4f7fb 36%, #fff 100%);
}
button, input, table { font-family: inherit; }
a { color: inherit; text-decoration: none; }
.container { width: min(1100px, calc(100% - 28px)); margin-inline: auto; }
.hidden { display: none !important; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(14px);
}
.topbar__inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.brand__mark {
    width: 68px;
    height: 68px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -1px;
    background: linear-gradient(145deg, #0f766e, #111827);
    box-shadow: var(--shadow);
}

.page { padding: 28px 0 48px; }
.panel {
    background: rgba(255,255,255,.98);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 22px;
}
.upload-box {
    min-height: 160px;
    border: 2px dashed #b8d8d5;
    border-radius: 24px;
    background: #fbfefe;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 22px;
    transition: .16s ease;
}
.upload-box.is-dragover {
    background: #eef8f7;
    border-color: var(--primary);
    transform: translateY(-2px);
}
.btn {
    border: 0;
    outline: none;
    min-height: 52px;
    padding: 12px 24px;
    border-radius: 18px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    transition: .16s ease;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn-primary {
    color: #fff;
    background: linear-gradient(145deg, var(--primary), var(--primary2));
    box-shadow: 0 14px 28px rgba(15,118,110,.2);
}
.btn-light { background: #eef2f7; color: var(--text); }
.btn-muted { background: transparent; color: var(--muted); }
.preview {
    margin-top: 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
}
.preview img {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: contain;
}
.progress {
    margin-top: 16px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #fff;
}
.progress__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-weight: 900;
    margin-bottom: 10px;
}
.progress__line {
    height: 12px;
    border-radius: 99px;
    overflow: hidden;
    background: #e5e7eb;
}
.progress__line span {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #22c55e);
    transition: width .25s ease;
}
.alert {
    margin-top: 16px;
    border-radius: 18px;
    padding: 13px 15px;
    font-weight: 900;
    line-height: 1.7;
}
.alert-success { color: var(--success); background: #ecfdf3; border: 1px solid #abefc6; }
.alert-error { color: var(--danger); background: #fef3f2; border: 1px solid #fecdca; }
.result-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    max-height: 70vh;
}
table {
    width: 100%;
    border-collapse: collapse;
    direction: rtl;
    min-width: 720px;
}
th, td {
    border: 1px solid #d0d5dd;
    padding: 10px 12px;
    min-width: 110px;
    max-width: 320px;
    vertical-align: middle;
    white-space: pre-wrap;
    line-height: 1.65;
    text-align: right;
    font-size: 15px;
}
th {
    background: #f2f4f7;
    font-weight: 900;
}
td[contenteditable="true"] { background: #fff; }
td[contenteditable="true"]:focus, th[contenteditable="true"]:focus {
    outline: 2px solid rgba(15,118,110,.3);
    outline-offset: -2px;
    background: #f8fffe;
}

@media (max-width: 640px) {
    .container { width: min(100% - 20px, 1100px); }
    .page { padding-top: 18px; }
    .panel { padding: 16px; border-radius: 24px; }
    .upload-box { min-height: 142px; gap: 8px; }
    .btn { min-height: 50px; padding: 11px 18px; font-size: 15px; }
    .brand__mark { width: 58px; height: 58px; border-radius: 20px; font-size: 24px; }
    th, td { min-width: 120px; padding: 9px; font-size: 14px; }
}

.file-list {
    padding: 16px 18px;
    color: var(--text);
    font-weight: 800;
}
.file-list__title {
    margin-bottom: 8px;
    color: var(--primary2);
    font-size: 16px;
}
.file-list ul {
    margin: 0;
    padding: 0 18px 0 0;
    line-height: 1.9;
    color: var(--muted);
    font-size: 14px;
}
