:root {
    --bg: #07100b;
    --panel: rgba(16, 26, 20, 0.9);
    --panel-solid: #101a14;
    --panel-2: #142119;
    --panel-3: #17291d;

    --text: #f3fbf5;
    --muted: #9eb0a4;
    --border: #26382c;

    --accent: #6ee787;
    --accent-dark: #2ea043;
    --accent-soft: rgba(110, 231, 135, 0.14);

    --danger: #ff5d5d;
    --danger-soft: rgba(255, 93, 93, 0.12);
    --danger-border: rgba(255, 93, 93, 0.35);
    --danger-text: #ffb8b8;

    --input-bg: #0b130e;

    --radius-sm: 12px;
    --radius-md: 14px;
    --radius-lg: 18px;

    --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
    --focus-ring: 0 0 0 4px var(--accent-soft);

    --page-width: 1080px;
}

/* Base */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background:
        radial-gradient(circle at top left, rgba(110, 231, 135, 0.18), transparent 32rem),
        radial-gradient(circle at bottom right, rgba(46, 160, 67, 0.16), transparent 32rem),
        var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

img {
    max-width: 100%;
}

/* Typography */

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.15rem;
    font-size: 1.45rem;
    line-height: 1.1;
}

h2 {
    margin-bottom: 0.5rem;
    font-size: 1.6rem;
    line-height: 1.15;
}

h3 {
    margin-bottom: 0.35rem;
    font-size: 1.05rem;
    line-height: 1.2;
}

p {
    color: var(--muted);
    line-height: 1.5;
}

/* Shared surfaces */

.login-card,
.panel,
.tool-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

/* Login */

.login-page {
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.login-wrap {
    width: 100%;
    max-width: 420px;
}

.login-card {
    padding: 1.5rem;
}

.login-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.4rem;
}

.login-logo {
    display: block;
    width: auto;
    max-width: 240px;
    max-height: 130px;
    height: auto;
    filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.45));
}

/* Forms */

label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 650;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    color: var(--text);
    padding: 0.95rem 1rem;
    font: inherit;
    font-size: 1rem;
    outline: none;
}

textarea {
    min-height: 130px;
    resize: vertical;
    line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

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

.field {
    min-width: 0;
}

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

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-start;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.form-actions button {
    width: auto;
    min-width: 160px;
}

/* Buttons and button-like links */

button:not(.hamburger-button):not(.danger-button),
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #061007;
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

button:not(.hamburger-button):not(.danger-button):hover,
.button-link:hover {
    filter: brightness(1.04);
}

.login-card button {
    width: 100%;
    margin-top: 1rem;
}

.button-link.secondary {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.button-link.secondary:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    filter: none;
}

.danger-button {
    width: auto;
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    background: var(--danger-soft);
    color: var(--danger-text);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.danger-button:hover {
    border-color: var(--danger);
    background: rgba(255, 93, 93, 0.18);
    color: #ffffff;
}

/* Notices */

.notice {
    margin: 0.9rem 0 0;
    padding: 0.8rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
}

.notice.error {
    border: 1px solid var(--danger-border);
    background: var(--danger-soft);
    color: var(--danger-text);
}

/* Main menu */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 0.75rem 1rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 16, 11, 0.78);
    backdrop-filter: blur(14px);
}

.menu-logo-link {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    flex-shrink: 0;
    text-decoration: none;
}

.menu-logo {
    display: block;
    width: auto;
    max-width: 150px;
    max-height: 42px;
    height: auto;
    filter: drop-shadow(0 5px 14px rgba(0, 0, 0, 0.45));
}

.main-menu {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.main-menu a {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.main-menu a:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text);
}

.main-menu a.logout-button {
    border-color: var(--danger-border);
    color: var(--danger-text);
}

.main-menu a.logout-button:hover {
    border-color: var(--danger);
    background: var(--danger-soft);
    color: #ffffff;
}

.hamburger-button {
    display: none;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
}

.hamburger-button:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.hamburger-button span {
    display: block;
    width: 20px;
    height: 2px;
    margin: 4px auto;
    border-radius: 999px;
    background: var(--text);
    transition:
        transform 0.15s ease,
        opacity 0.15s ease;
}

.hamburger-button.open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hamburger-button.open span:nth-child(2) {
    opacity: 0;
}

.hamburger-button.open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Page layout */

.page {
    width: 100%;
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 1.25rem;
}

.panel {
    padding: 1.25rem;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-heading p {
    margin-bottom: 0;
}

/* Cards */

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.tool-card {
    display: block;
    padding: 1rem;
    background: var(--panel-2);
    text-decoration: none;
    transition:
        transform 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}

.tool-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: var(--panel-3);
}

.tool-card p {
    margin-bottom: 0;
}

/* Tables */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(11, 19, 14, 0.55);
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

th,
td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

td {
    color: var(--text);
    font-size: 0.95rem;
}

tbody tr:hover {
    background: rgba(110, 231, 135, 0.055);
}

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

.table-main-link {
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
}

.table-main-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    white-space: nowrap;
}

.actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
}

.actions a:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text);
    text-decoration: none;
}

.actions form {
    margin: 0;
}

/* Mobile */

@media (max-width: 640px) {
    .site-header {
        min-height: 66px;
        padding: 0.75rem;
    }

    .menu-logo {
        max-width: 125px;
        max-height: 36px;
    }

    .hamburger-button {
        display: block;
    }

    .main-menu {
        display: none;
        position: absolute;
        top: calc(100% + 1px);
        left: 0.75rem;
        right: 0.75rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.75rem;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: rgba(7, 16, 11, 0.96);
        box-shadow: var(--shadow);
        backdrop-filter: blur(14px);
    }

    .main-menu.open {
        display: flex;
    }

    .main-menu a {
        width: 100%;
        border-radius: var(--radius-sm);
        padding: 0.75rem 0.85rem;
        text-align: center;
    }

    .login-card,
    .panel {
        padding: 1rem;
    }

    .login-logo {
        max-width: 210px;
        max-height: 110px;
    }

    .page {
        padding: 1rem;
    }

    .page-heading {
        flex-direction: column;
        align-items: stretch;
    }

    .button-link {
        width: 100%;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions button {
        width: 100%;
    }
}