@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");
@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css");

:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #16181d;
    --muted: #667085;
    --line: #dde2ea;
    --primary: #255f85;
    --primary-hover: #1d4d6c;
    --success-bg: #eaf7ef;
    --success-text: #18633a;
    --error-bg: #fff0f0;
    --error-text: #9b1c1c;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
}

.app-shell {
    display: grid;
    grid-template-columns: 238px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    padding: 18px 12px;
    background: #ffffff;
    border-right: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 10px;
    color: #111318;
    font-size: 19px;
    font-weight: 800;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: #111318;
    transform: rotate(45deg);
}

.sidebar-nav {
    display: grid;
    gap: 10px;
    margin-top: 26px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 10px;
    color: #111318;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.16s ease, opacity 0.16s ease;
}

.sidebar-link:hover,
.sidebar-link.is-active {
    background: #f7f5f4;
    text-decoration: none;
}

.sidebar-icon {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: #111318;
    font-weight: 800;
}

.sidebar-icon svg {
    display: block;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-area {
    min-width: 0;
}

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

a:hover {
    text-decoration: underline;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #eef1f5;
    color: #273445;
    font-size: 13px;
}

.id-badge {
    display: inline-flex;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    background: #f3f6fa;
    color: #344054;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    font-weight: 600;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 64px;
    padding: 0 28px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.topbar div,
.topbar nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar strong {
    font-size: 16px;
}

.topbar span {
    color: var(--muted);
    font-size: 14px;
}

.account-link {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.account-link:hover {
    color: var(--text);
    text-decoration: none;
}

.topbar .button {
    width: auto;
    min-height: 34px;
}

.logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 17px;
    border-radius: 999px;
    background: #000;
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 1;
    transition: opacity 0.16s ease;
}

.logout-button:hover {
    color: #fff;
    opacity: 0.8;
    text-decoration: none;
}

.logout-button:visited,
.logout-button:focus {
    color: #fff;
}

.logout-button i {
    font-size: 13px;
}

.topbar .logout-button span {
    color: #fff;
    font-size: 13px;
    font-weight: 400;
}

.container {
    width: min(1180px, calc(100vw - 40px));
    margin: 34px auto 70px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.page-heading h1 {
    margin: 0 0 8px;
    font-size: 31px;
    line-height: 1.15;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
}

.panel {
    margin-bottom: 20px;
    padding: 22px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.panel h2 {
    margin: 0 0 18px;
    font-size: 18px;
}

.panel-wide {
    grid-column: 1 / -1;
}

.notice {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-weight: 600;
}

.notice-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.notice-error {
    background: var(--error-bg);
    color: var(--error-text);
}

.empty {
    margin: 0;
    color: var(--muted);
}

.admin-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(420px, 100%);
    padding: 30px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 18px 45px rgba(16, 24, 40, 0.09);
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 25px;
}

.auth-card p {
    margin: 0 0 24px;
    color: var(--muted);
}

.form-stack,
.form-grid,
.translation-grid {
    display: grid;
    gap: 16px;
}

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

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

label span {
    display: block;
    margin-bottom: 7px;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #cfd6df;
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(37, 95, 133, 0.14);
    border-color: var(--primary);
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px auto;
    gap: 12px;
    align-items: center;
}

.copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.embed-help {
    margin: -6px 0 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.embed-code {
    min-height: 74px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.45;
    resize: none;
}

.embed-list {
    display: grid;
    gap: 16px;
}

.embed-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.language-clone-form {
    display: grid;
    grid-template-columns: 180px max-content;
    gap: 14px;
    align-items: end;
}

.language-clone-form .button {
    width: auto;
    padding-left: 16px;
    padding-right: 16px;
    justify-self: start;
}

.language-add-form {
    display: grid;
    grid-template-columns: minmax(0, 150px) minmax(0, 260px) max-content;
    gap: 14px;
    align-items: end;
}

.language-add-form .button {
    width: auto;
    padding-left: 16px;
    padding-right: 16px;
    justify-self: start;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 15px;
    border: 1px solid #cfd6df;
    border-radius: 7px;
    background: #fff;
    color: #253142;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover {
    background: #f2f5f8;
    text-decoration: none;
}

.button-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.button-primary:hover {
    background: var(--primary-hover);
}

.button-danger {
    border-color: #f3b4b4;
    background: #fff;
    color: #b42318;
}

.button-danger:hover {
    background: #fff0f0;
}

.button-small {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.inline-action {
    display: inline;
}

.language-row-form {
    margin: 0;
}

.language-row-form input[name="code"] {
    width: 74px;
    min-height: 34px;
    text-transform: lowercase;
}

td input[form^="language-update-"] {
    min-height: 34px;
}

.muted-text {
    color: var(--muted);
    font-size: 13px;
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(22, 24, 29, 0.34);
}

.confirm-overlay.is-visible {
    display: flex;
}

.confirm-dialog {
    width: min(430px, 100%);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 18px 45px rgba(16, 24, 40, 0.16);
}

.info-dialog input {
    margin-top: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.confirm-dialog h2 {
    margin: 0 0 10px;
    font-size: 20px;
    line-height: 1.25;
}

.confirm-dialog p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.table-wrap {
    overflow-x: auto;
}

.table-tools {
    display: flex;
    justify-content: flex-start;
    margin: -4px 0 16px;
}

.table-search {
    width: min(360px, 100%);
}

.table-search span {
    font-size: 12px;
}

.search-empty {
    margin-top: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
}

button.status-icon {
    cursor: pointer;
}

button.status-icon:hover {
    opacity: 0.82;
}

.status-icon-ok {
    background: #e8f7ee;
    color: #16803c;
}

.status-icon-error {
    background: #fff0f0;
    color: #b42318;
}

.status-icon-info {
    background: #eef4ff;
    color: #255f85;
}

th {
    color: #475467;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: inherit;
}

.sort-link:hover {
    color: var(--text);
    text-decoration: none;
}

.sort-link.is-active {
    color: var(--text);
}

tr:last-child td {
    border-bottom: 0;
}

.edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.color-grid label span {
    min-height: 34px;
}

.color-grid input {
    width: 100%;
    height: 42px;
    padding: 3px;
    border: 1px solid #cfd6df;
    border-radius: 7px;
    background: #fff;
}

.checks {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 20px;
}

.checks-spaced {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.checkbox-line {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.checkbox-line input {
    width: 18px;
    height: 18px;
}

.checkbox-line span {
    margin: 0;
    font-size: 14px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.tab-button {
    padding: 10px 14px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.tab-button.is-active {
    border-color: var(--primary);
    color: var(--primary);
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 4px 0 20px;
}

@media (max-width: 840px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
    }

    .topbar,
    .topbar div,
    .topbar nav,
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .container {
        width: min(100% - 24px, 1180px);
        margin-top: 22px;
    }

    .edit-grid,
    .form-grid,
    .translation-grid,
    .color-grid,
    .inline-form,
    .copy-row,
    .embed-row,
    .language-clone-form,
    .language-add-form {
        grid-template-columns: 1fr;
    }

    .form-actions {
        justify-content: stretch;
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .language-clone-form .button,
    .language-add-form .button {
        width: auto;
    }
}
