:root {
    --bg: #f3f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e5e7eb;
    --blue: #2563eb;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Manrope, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; }

.icon-download {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex: 0 0 auto;
}

.topbar {
    height: 76px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: 300px minmax(340px, 1fr) auto 44px;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
}

.brand-wrap {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #2563eb;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 27px;
    line-height: 1;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text strong { font-size: 34px; font-weight: 800; }
.brand-text small { color: var(--muted); font-size: 14px; }

.global-search input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 14px;
    font-size: 14px;
    background: #f8fafc;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topnav-link {
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
}

.lang-switch {
    display: inline-flex;
    padding: 4px;
    background: #f3f4f6;
    border-radius: 10px;
    gap: 4px;
}
.lang-switch form {
    margin: 0;
}

.lang-switch button {
    border: 0;
    background: transparent;
    padding: 6px 10px;
    border-radius: 8px;
    font-weight: 700;
    color: #334155;
    font-size: 12px;
}

.lang-switch .active {
    background: #fff;
    color: #2563eb;
}

.mode-btn {
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 16px;
    background: #fff;
}

.user-block.clean { justify-self: end; }
.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: #111827;
    font-weight: 700;
    font-size: 13px;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 22px;
}

.layout {
    display: grid;
    grid-template-columns: 344px 1fr;
    gap: 22px;
}

.filter-panel {
    background: #fff;
    border: 1px solid #dfe3ea;
    border-radius: 14px;
    padding: 20px 18px;
}

.panel-title {
    margin: 2px 0 20px;
    font-size: 20px;
}

.stat-block h4,
.filters h4 {
    margin: 0 0 10px;
    font-size: 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    color: #334155;
    font-size: 14px;
}

.count-pill {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 16px;
}

.count-pill.gray { background: #e5e7eb; }
.count-pill.green { background: #bbf7d0; }
.count-pill.yellow { background: #fde68a; }
.count-pill.red { background: #fecaca; }
.count-pill.violet { background: #e9d5ff; }
.count-pill.blue { background: #bfdbfe; }

.filters {
    margin-top: 24px;
    display: grid;
    gap: 8px;
}

.filters label {
    font-size: 14px;
    font-weight: 700;
    margin-top: 6px;
}

input, select, textarea {
    width: 100%;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #f3f4f6;
    padding: 0 14px;
    font-family: inherit;
    font-size: 14px;
}

.btn-light,
.btn-reset-full {
    margin-top: 8px;
    text-decoration: none;
    border-radius: 10px;
    border: 1px solid var(--line);
    padding: 12px 14px;
    font-weight: 700;
    text-align: center;
    font-size: 15px;
    background: #fff;
}

.btn-light {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.result-title {
    margin: 0 0 16px;
    font-size: 18px;
}

.doc-card.refined {
    background: #fff;
    border: 1px solid #dde3ec;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 14px;
    align-items: start;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.doc-card.refined:hover {
    border-color: #93c5fd;
    background: #f8fbff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
}

.doc-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #edf2ff;
    color: var(--blue);
    display: grid;
    place-items: center;
    font-size: 22px;
}

.doc-number {
    color: #64748b;
    margin: 0 0 4px;
    font-size: 16px;
}

.doc-main h3 {
    margin: 0 0 8px;
    font-size: 22px;
    line-height: 1.22;
}

.doc-desc {
    margin: 0 0 10px;
    color: #475569;
    font-size: 17px;
    line-height: 1.35;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: #64748b;
    font-size: 15px;
}

.chip.type {
    background: #e5e7eb;
    color: #111827;
    border-radius: 999px;
    padding: 3px 12px;
    font-weight: 700;
}

.doc-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 20px;
}

.status {
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 700;
    font-size: 16px;
    color: #166534;
}

.view-link {
    color: #2563eb;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-weight: 700;
    font-size: 18px;
}

.download-link {
    text-decoration: none;
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111827;
}

.alert {
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
}
.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.modal-open {
    overflow: hidden;
}

.doc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 16px;
}

.doc-modal-overlay[hidden] {
    display: none !important;
}

.doc-modal {
    width: min(760px, 96vw);
    max-height: 92vh;
    overflow: auto;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #dfe3ea;
    padding: 18px 18px 14px;
    position: relative;
}

.modal-close-icon {
    position: absolute;
    right: 12px;
    top: 10px;
    border: 0;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
}

.modal-header {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 10px;
    align-items: start;
    margin-bottom: 12px;
}

.modal-header h3 {
    margin: 0 0 8px;
    font-size: 38px;
}

.modal-tabs,
.sub-tabs {
    background: #e5e7eb;
    border-radius: 13px;
    padding: 4px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 12px;
}

.sub-tabs {
    grid-template-columns: repeat(3, 1fr);
}

.tab-btn,
.sub-tab-btn {
    border: 0;
    background: transparent;
    border-radius: 10px;
    padding: 9px 10px;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
}

.tab-btn.active,
.sub-tab-btn.active {
    background: #fff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
}

.tab-content label {
    display: block;
    color: #64748b;
    font-size: 13px;
    margin-bottom: 4px;
}

.tab-content b,
.tab-content p,
.tab-content small {
    margin: 0;
}

.info-wide {
    margin-top: 10px;
}

.keyword-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lang-file-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 6px;
}

.lang-file-btn {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    background: #fff;
}

.lang-file-btn.disabled {
    pointer-events: none;
    opacity: 0.45;
}

.versions-list,
.logs-list {
    display: grid;
    gap: 10px;
}

.version-card,
.log-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.version-card.current {
    border-color: #86efac;
    background: #ecfdf5;
}

.version-card h5 {
    margin: 0 0 6px;
    font-size: 16px;
}

.current-tag {
    margin-left: 6px;
    font-size: 12px;
    color: #166534;
}

.log-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #e5e7eb;
    margin-top: 14px;
    padding-top: 12px;
}

.main-download-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    background: #2563eb;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    padding: 11px 14px;
}

.modal-close-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 10px;
    padding: 11px 18px;
    cursor: pointer;
}

.reports-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
    z-index: 1100;
    display: grid;
    place-items: center;
    padding: 12px;
}

.reports-modal-overlay[hidden] {
    display: none !important;
}

.reports-modal {
    width: min(920px, 96vw);
    max-height: 94vh;
    overflow: auto;
    background: #fff;
    border: 1px solid #dfe3ea;
    border-radius: 14px;
    padding: 16px;
    position: relative;
}

.reports-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.reports-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reports-header h3 {
    margin: 0;
    font-size: 34px;
}

.reports-header p {
    margin: 4px 0 0;
    color: #64748b;
}

.reports-export-btns {
    display: flex;
    gap: 8px;
}

.reports-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    white-space: nowrap;
}

.reports-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #64748b;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.reports-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: #e5e7eb;
    margin-bottom: 12px;
}

.reports-tab {
    border: 0;
    border-radius: 999px;
    background: transparent;
    padding: 8px 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

.reports-tab.active {
    background: #fff;
}

.reports-panel {
    display: none;
}

.reports-panel.active {
    display: block;
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.overview-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.overview-card span {
    color: #64748b;
    font-weight: 700;
}

.overview-card b {
    font-size: 28px;
}

.overview-card b.green { color: #16a34a; }
.overview-card b.orange { color: #d97706; }
.overview-card b.red { color: #ea580c; }

.reports-block {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
}

.reports-block h4 {
    margin: 0 0 12px;
    font-size: 20px;
}

.report-row {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) 1fr 36px;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.report-label {
    font-weight: 700;
}

.report-bar-wrap {
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.report-bar {
    height: 100%;
    border-radius: 999px;
}

.report-count {
    text-align: right;
    font-weight: 700;
}

.reports-muted {
    color: #64748b;
    margin: 0 0 10px;
}

.reports-empty {
    color: #64748b;
    text-align: center;
    padding: 24px 0;
}

.need-update-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.need-update-card p {
    margin: 4px 0 0;
    color: #64748b;
}

.detail-card, .reports, .form-wrap, .sidebar, .content {
    background: #fff;
    border: 1px solid #dfe3ea;
    border-radius: 14px;
    padding: 18px;
}

.admin-upload-wrap {
    max-width: 1080px;
    margin: 0 auto;
}

.admin-upload-head h2 {
    margin: 0 0 6px;
    font-size: 26px;
}

.admin-upload-head p {
    margin: 0 0 14px;
    color: #64748b;
    font-size: 14px;
}

.admin-upload-form {
    display: grid;
    gap: 14px;
}

.form-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
}

.form-card h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.form-grid {
    display: grid;
    gap: 10px 12px;
}

.form-grid.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three-cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.form-field small {
    min-height: 16px;
    color: #dc2626;
    font-size: 12px;
}

.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea {
    border-color: #f87171;
    background: #fff7f7;
}

.full-row {
    grid-column: 1 / -1;
}

.toggle-wrap {
    height: 44px;
    display: flex;
    align-items: center;
}

.form-field textarea {
    min-height: 104px;
    height: auto;
    padding: 10px 12px;
}

.form-field input[type="file"] {
    padding: 10px 12px;
    height: auto;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}
th, td {
    border: 1px solid #e5e7eb;
    text-align: left;
    padding: 8px;
}

.params {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 6px;
    list-style: none;
    padding: 0;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}
.auth-card {
    width: min(440px, 92vw);
    padding: 26px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #dfe3ea;
}

@media (max-width: 1200px) {
    .topbar {
        grid-template-columns: 1fr;
        height: auto;
        padding: 12px;
        gap: 10px;
    }
    .brand-text strong { font-size: 26px; }
    .brand-text small { font-size: 13px; }
    .layout { grid-template-columns: 1fr; }
    .result-title { font-size: 30px; }
    .doc-main h3 { font-size: 26px; }
    .doc-desc, .meta, .doc-number, .filters label, input, select { font-size: 14px; }
    .panel-title { font-size: 24px; }
    .stat-row { font-size: 14px; }
    .doc-card.refined { grid-template-columns: 42px 1fr; }
    .doc-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .doc-modal { width: min(96vw, 560px); }
    .modal-header h3 { font-size: 30px; }
    .info-grid { grid-template-columns: 1fr; }
    .lang-file-row { grid-template-columns: 1fr; }
    .reports-modal { width: min(96vw, 700px); }
    .reports-header { flex-direction: column; }
    .reports-header-actions { width: 100%; justify-content: space-between; }
    .reports-tabs { grid-template-columns: 1fr; border-radius: 12px; }
    .overview-cards { grid-template-columns: 1fr 1fr; }
    .report-row { grid-template-columns: 1fr; gap: 6px; }
    .report-count { text-align: left; }
}
