:root {
    --background: #f4f5f7;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --muted: #6b7280;

    --primary: #6366f1;
    --primary-hover: #4f46e5;

    --danger: #dc2626;

    --radius: 14px;
    --shadow:
        0 10px 30px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--background);
    color: var(--text);
}

/* ---------------------------------------------
   Login
   --------------------------------------------- */

.login-page {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;
}

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

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius);

    padding: 40px;

    box-shadow: var(--shadow);
}

.brand {
    text-align: center;
    margin-bottom: 32px;
}

.brand-icon {
    font-size: 42px;
    margin-bottom: 8px;
}

.brand h1 {
    margin: 0;

    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand p {
    margin: 6px 0 0;

    color: var(--muted);
    font-size: 14px;
}

/* ---------------------------------------------
   Forms
   --------------------------------------------- */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;

    margin-bottom: 7px;

    font-size: 14px;
    font-weight: 600;
}

.form-group input {
    width: 100%;

    padding: 11px 13px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: #fff;

    color: var(--text);

    font-size: 15px;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.form-group input:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.12);
}

.primary-button {
    width: 100%;

    border: none;
    border-radius: 9px;

    padding: 12px 16px;

    background: var(--primary);
    color: white;

    font-size: 15px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.15s ease,
        transform 0.05s ease;
}

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

.primary-button:active {
    transform: translateY(1px);
}

.primary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-error {
    margin-bottom: 16px;

    padding: 10px 12px;

    border-radius: 8px;

    background: #fef2f2;
    border: 1px solid #fecaca;

    color: var(--danger);

    font-size: 14px;
}

.hidden {
    display: none;
}

/* ---------------------------------------------
   Dashboard
   --------------------------------------------- */

.dashboard-page {
    min-height: 100vh;
}

.topbar {
    height: 64px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 32px;

    background: var(--surface);

    border-bottom: 1px solid var(--border);
}

.brand-small {
    display: flex;
    align-items: center;
    gap: 9px;

    font-size: 17px;
    font-weight: 700;
}

.brand-icon-small {
    font-size: 20px;
}

.user-area {
    color: var(--muted);
    font-size: 14px;
}

.dashboard-content {
    max-width: 1400px;

    margin: 0 auto;

    padding: 40px 32px;
}

.page-heading h1 {
    margin: 0;

    font-size: 28px;
    letter-spacing: -0.02em;
}

.page-heading p {
    margin: 7px 0 0;

    color: var(--muted);
}

.empty-state {
    margin-top: 32px;

    padding: 70px 30px;

    text-align: center;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius);

    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.empty-state h2 {
    margin: 0;

    font-size: 18px;
}

.empty-state p {
    margin: 8px 0 0;

    color: var(--muted);
    font-size: 14px;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.table-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
}

.duplicate-option:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.duplicate-option:disabled:hover {
    border-color: var(--border);
}

/* =============================================
   KIIRASTULI DASHBOARD
   ============================================= */

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.heading-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-button {
    width: auto;
}

.secondary-button,
.logout-button {
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 15px;

    background: #ffffff;
    color: var(--text);

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}

.secondary-button:hover,
.logout-button:hover {
    background: #f9fafb;
}

.logout-button {
    margin-left: 14px;
    padding: 7px 11px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-top: 24px;
}

.search-box {
    width: 380px;

    display: flex;
    align-items: center;
    gap: 9px;

    padding: 10px 13px;

    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.search-box input {
    width: 100%;

    border: none;
    outline: none;
    background: transparent;

    color: var(--text);
    font-size: 14px;
}

.search-box span {
    color: var(--muted);
}

.filters {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-button {
    padding: 9px 13px;

    border: 1px solid transparent;
    border-radius: 8px;

    background: transparent;
    color: var(--muted);

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
}

.filter-button:hover {
    background: #ffffff;
}

.filter-button.active {
    background: #ffffff;
    color: var(--text);

    border-color: var(--border);

    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.table-card {
    margin-top: 18px;

    overflow: hidden;

    background: #ffffff;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    box-shadow: var(--shadow);
}

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

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

    font-size: 14px;
}

thead {
    background: #fafafa;
}

th {
    padding: 13px 18px;

    text-align: left;

    color: var(--muted);

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.04em;

    border-bottom: 1px solid var(--border);
}

td {
    padding: 15px 18px;

    border-bottom: 1px solid #f0f1f3;
}

tbody tr {
    transition: background 0.1s ease;
}

tbody tr[data-device-id] {
    cursor: pointer;
}

tbody tr[data-device-id]:hover {
    background: #fafbff;
}

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

.device-name {
    display: flex;
    align-items: center;
    gap: 7px;

    font-weight: 600;
}

.mono {
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        monospace;

    font-size: 13px;
}

.muted {
    color: var(--muted);
}

.row-action {
    width: 50px;
    text-align: right;
}

.icon-button {
    width: 30px;
    height: 30px;

    border: 1px solid var(--border);
    border-radius: 7px;

    background: #ffffff;
    color: var(--muted);

    cursor: pointer;
}

.table-footer {
    padding: 12px 18px;

    border-top: 1px solid var(--border);

    color: var(--muted);
    font-size: 12px;
}

.table-empty {
    padding: 42px 20px;

    text-align: center;
    color: var(--muted);
}

.duplicate-row {
    background: #fffafa;
}

.duplicate-mark {
    width: 18px;
    height: 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #ef4444;
    color: #ffffff;

    font-size: 11px;
    font-weight: 800;
}

.warning-banner {
    margin-top: 26px;

    display: flex;
    align-items: center;
    gap: 13px;

    padding: 14px 16px;

    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 11px;

    color: #9a3412;
}

.warning-icon {
    width: 25px;
    height: 25px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 50%;

    background: #f97316;
    color: #ffffff;

    font-weight: 800;
}

.warning-banner > div {
    display: flex;
    flex-direction: column;
    gap: 2px;

    flex: 1;
}

.warning-banner > div span {
    font-size: 13px;
}

.warning-banner button {
    border: none;
    background: transparent;

    color: #9a3412;
    font-weight: 700;

    cursor: pointer;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(15, 23, 42, 0.45);

    backdrop-filter: blur(3px);
}

.modal {
    width: 100%;
    max-width: 650px;
    max-height: calc(100vh - 48px);

    overflow-y: auto;

    padding: 28px;

    background: #ffffff;

    border: 1px solid var(--border);
    border-radius: 16px;

    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.18);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    margin-bottom: 25px;
}

.modal-header h2 {
    margin: 4px 0 0;

    font-size: 21px;
}

.modal-close {
    border: none;
    background: transparent;

    color: var(--muted);

    font-size: 26px;
    line-height: 1;

    cursor: pointer;
}

.modal-eyebrow {
    color: var(--primary);

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;

    margin-top: 24px;
}

.warning-banner.hidden {
    display: none;
}