:root {
    --bg: #eef2f7;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --border: #dbe3ee;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --sidebar-top: #0f172a;
    --sidebar-bottom: #1e293b;
    --sidebar-link: #e5e7eb;
    --sidebar-link-hover: rgba(255,255,255,0.08);
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
    color: var(--text);
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--sidebar-top) 0%, var(--sidebar-bottom) 100%);
    color: #fff;
    padding: 18px 16px;
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.04);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar h2 {
    margin: 0 0 18px;
    font-size: 19px;
    line-height: 1.2;
    letter-spacing: 0.2px;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar li {
    margin: 0;
}

.sidebar a {
    display: block;
    color: var(--sidebar-link);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
    transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease;
    font-size: 15px;
    line-height: 1.25;
}

.sidebar a:hover {
    background: var(--sidebar-link-hover);
    color: #fff;
    transform: translateX(2px);
}

.content {
    flex: 1;
    padding: 28px;
    background: transparent;
    min-width: 0;
}

h1 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 30px;
}

h3 {
    margin-top: 0;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 22px;
    border-radius: var(--radius);
    min-width: 0;
    box-shadow: var(--shadow);
}

.card p {
    margin: 8px 0 0;
    font-size: 28px;
    font-weight: bold;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.page-head h1 {
    margin-bottom: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: var(--panel);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

th, td {
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

tr:hover td {
    background: #fbfdff;
}

.form-grid {
    display: grid;
    grid-template-columns: 180px minmax(280px, 1fr);
    gap: 12px 16px;
    max-width: 980px;
    background: var(--panel);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.form-grid label {
    font-weight: bold;
    align-self: center;
}

.inline-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    background: var(--panel);
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

input, select, textarea, button {
    padding: 11px 12px;
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid #cfd8e3;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.button, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    text-decoration: none;
    cursor: pointer;
    border-radius: 10px;
    padding: 11px 16px;
    font-weight: bold;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.button:hover, button:hover {
    filter: brightness(1.03);
}

.alert {
    background: var(--danger-bg);
    color: var(--danger-text);
    padding: 12px 14px;
    margin-bottom: 15px;
    border-radius: 10px;
    border: 1px solid #fecaca;
}

.notice {
    background: var(--warning-bg);
    color: var(--warning-text);
    padding: 12px 14px;
    margin-bottom: 15px;
    border-radius: 10px;
    border: 1px solid #fde68a;
}

.success {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 12px 14px;
    margin-bottom: 15px;
    border-radius: 10px;
    border: 1px solid #86efac;
}

.login-box {
    width: 390px;
    margin: 90px auto;
    background: var(--panel);
    padding: 30px;
    border-radius: 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 22px;
}

.login-box form {
    display: grid;
    gap: 12px;
}

a {
    color: var(--primary);
}

.small {
    color: var(--muted);
    font-size: 13px;
}

.badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: bold;
}

.row-danger td {
    background: #fff7f7;
}

.row-warning td {
    background: #fffdf3;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.button-danger {
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.22);
}

@media (max-width: 980px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 14px;
    }

    .sidebar ul {
        gap: 4px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .cards {
        grid-template-columns: 1fr;
    }
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.button-excel {
    background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 8px 18px rgba(22, 163, 74, 0.25);
}

.button-excel:hover {
    filter: brightness(1.05);
}

.sort-link {
    color: inherit;
    text-decoration: none;
    font-weight: bold;
}

.sort-link:hover {
    text-decoration: underline;
}

.sort-link.active {
    color: #1d4ed8;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.button-danger {
    background-color: #dc2626;
    color: #fff;
}

.button-danger:hover {
    background-color: #b91c1c;
}

.sort-link {
    color: inherit;
    text-decoration: none;
    font-weight: bold;
}

.sort-link:hover {
    text-decoration: underline;
}

.sort-link.active {
    color: #1d4ed8;
}

.button-icon {
    min-width: 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 999px;
    font-weight: bold;
    font-size: 16px;
    line-height: 36px;
    text-align: center;
}

.detail-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.detail-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px 16px;
}

.detail-label {
    font-weight: bold;
    color: var(--muted);
}

.detail-photo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.detail-photo {
    max-width: 100%;
    max-height: 320px;
    border-radius: 10px;
}

@media (max-width: 980px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.drop-area {
    border: 2px dashed #94a3b8;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: #f8fafc;
}

.drop-area.dragover {
    background: #e0f2fe;
    border-color: #0284c7;
}

.drop-area input {
    display: none;
}

.badge-tech {
    background: #e2e8f0;
    color: #0f172a;
    font-family: monospace;
    letter-spacing: 0.02em;
}

.section-row td {
    background: #eaf2ff !important;
    color: #1d4ed8;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-top: 2px solid #c7dbff;
}

.ral-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.ral-card {
    display: block;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ral-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

.ral-swatch {
    height: 120px;
    border-bottom: 1px solid var(--border);
}

.ral-body {
    padding: 16px;
}

.ral-code {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
}

.ral-name {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
    min-height: 40px;
}

.ral-meta {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.toggle-visibility {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.dashboard-collapse {
    margin-top: 30px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
}

.dashboard-collapse summary {
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.dashboard-collapse summary::-webkit-details-marker {
    display: none;
}

.dashboard-collapse[open] summary {
    margin-bottom: 14px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-warning {
    border-left: 4px solid #f59e0b;
}

.card-danger {
    border-left: 4px solid #ef4444;
}

.card-icon {
    font-size: 20px;
}

.card-value {
    font-size: 26px;
    font-weight: 700;
}

.card-label {
    font-size: 13px;
    color: #888;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.toggle-visibility {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 25px;
}

.dashboard-block {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.dashboard-collapse {
    margin-top: 30px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 14px 18px;
}

.dashboard-collapse summary {
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.dashboard-collapse summary::-webkit-details-marker {
    display: none;
}

.dashboard-collapse[open] summary {
    margin-bottom: 14px;
}

@media (max-width: 980px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}