/* HFD License Studio Pro - Executive Console redesign */

:root {
    --bg-body: #090b10;
    --bg-main: #0d1118;
    --bg-sidebar: #0a0c12;
    --bg-panel: rgba(18, 22, 31, 0.84);
    --bg-panel-solid: #121722;
    --bg-panel-soft: rgba(255, 255, 255, 0.045);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #edf0f5;
    --text-muted: #9aa4b2;
    --text-dim: #687385;
    --ink: #090b10;
    --accent: #d9b66f;
    --accent-2: #70d6c3;
    --accent-3: #8fa8ff;
    --accent-glow: rgba(217, 182, 111, 0.18);
    --emerald: #5ee0a0;
    --emerald-glow: rgba(94, 224, 160, 0.13);
    --purple: #a991ff;
    --purple-glow: rgba(169, 145, 255, 0.15);
    --rose: #ff7a91;
    --rose-glow: rgba(255, 122, 145, 0.14);
    --cyan: #70d6c3;
    --cyan-glow: rgba(112, 214, 195, 0.14);
    --sidebar-w: 286px;
    --topbar-h: 82px;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-soft: 0 18px 60px rgba(0, 0, 0, 0.26);
    --shadow-deep: 0 34px 90px rgba(0, 0, 0, 0.42);
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: 'JetBrains Mono', "SFMono-Regular", Consolas, monospace;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    line-height: 1.5;
    background:
        linear-gradient(145deg, rgba(217, 182, 111, 0.07), transparent 24%),
        linear-gradient(315deg, rgba(112, 214, 195, 0.07), transparent 28%),
        var(--bg-body);
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent 72%);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(217,182,111,0.52); }

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background:
        linear-gradient(160deg, rgba(217, 182, 111, 0.12), transparent 32%),
        linear-gradient(330deg, rgba(112, 214, 195, 0.10), transparent 35%),
        var(--bg-body);
}
.login-card {
    width: 100%;
    max-width: 438px;
    position: relative;
    padding: 38px;
    background: linear-gradient(180deg, rgba(24, 29, 40, 0.92), rgba(13, 17, 24, 0.92));
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(255,255,255,0.06);
    backdrop-filter: blur(22px);
    overflow: hidden;
}
.login-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
}
.login-header { margin-bottom: 30px; text-align: left; }
.login-logo,
.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    background: linear-gradient(135deg, #f4db9b, #c99d4d 48%, #70d6c3);
    box-shadow: 0 14px 34px rgba(217,182,111,0.22);
}
.login-logo {
    width: 58px;
    height: 58px;
    margin-bottom: 22px;
    border-radius: var(--radius);
}
.login-logo svg { width: 30px; height: 30px; fill: currentColor; }
.login-header h1 { max-width: 320px; color: #fff; font-size: 27px; font-weight: 900; line-height: 1.08; letter-spacing: 0; }
.login-header p { margin-top: 10px; color: var(--text-muted); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-footer { margin-top: 20px; text-align: center; }
.login-footer a { color: var(--accent); font-size: 13px; font-weight: 700; text-decoration: none; }
.login-footer a:hover { color: #f0d28a; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.form-control {
    width: 100%;
    min-height: 42px;
    padding: 10px 13px;
    font-family: var(--font);
    font-size: 13px;
    color: var(--text);
    background: rgba(255,255,255,0.055);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.form-control:hover { border-color: rgba(255,255,255,0.18); background: rgba(255,255,255,0.07); }
.form-control:focus { border-color: rgba(217,182,111,0.72); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-dim); }
select.form-control { cursor: pointer; }
select.form-control {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--accent) 50%),
        linear-gradient(135deg, var(--accent) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 38px;
}
select.form-control option {
    color: var(--text);
    background: #141923;
    font-weight: 700;
}
select.form-control option:checked {
    color: #141006;
    background: #d9b66f;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 10px 17px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    color: #131007;
    background: linear-gradient(135deg, #f3d892, #c99d4d);
    border-color: rgba(255,255,255,0.16);
    box-shadow: 0 12px 28px rgba(217,182,111,0.20);
}
.btn-primary:hover { box-shadow: 0 16px 38px rgba(217,182,111,0.28); }
.btn-secondary {
    color: var(--text);
    background: rgba(255,255,255,0.055);
    border-color: var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.09); border-color: var(--border-strong); }
.btn-purple {
    color: #0b1018;
    background: linear-gradient(135deg, #b8ddff, #a991ff);
    box-shadow: 0 12px 28px rgba(169,145,255,0.19);
}
.btn-danger {
    color: var(--rose);
    background: var(--rose-glow);
    border-color: rgba(255,122,145,0.28);
}
.btn-danger:hover { background: rgba(255,122,145,0.22); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 7px 12px; font-size: 12px; }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: color 0.18s, background 0.18s, border-color 0.18s, transform 0.18s;
}
.btn-icon:hover {
    color: var(--accent);
    background: rgba(217,182,111,0.10);
    border-color: rgba(217,182,111,0.32);
    transform: translateY(-1px);
}
.btn-icon-danger:hover { color: var(--rose); background: var(--rose-glow); border-color: rgba(255,122,145,0.32); }

.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.035), transparent 34%),
        var(--bg-sidebar);
    border-right: 1px solid var(--border);
    transition: width 0.32s cubic-bezier(0.4,0,0.2,1), opacity 0.25s, visibility 0.25s;
}
.sidebar::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(217,182,111,0.55), transparent);
}
.sidebar.hidden { width: 0; border-right: none; opacity: 0; visibility: hidden; }
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: var(--sidebar-w);
    padding: 22px 20px 18px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: var(--radius);
}
.sidebar-logo svg { width: 23px; height: 23px; fill: currentColor; }
.sidebar-title { color: #fff; font-size: 16px; font-weight: 900; line-height: 1.15; white-space: nowrap; }
.sidebar-subtitle { margin-top: 2px; color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; }
.sidebar-brand > div { min-width: 0; }
.sidebar-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.sidebar-close-btn:hover { color: var(--rose); border-color: rgba(255,122,145,0.28); background: var(--rose-glow); }
.sidebar-nav {
    min-width: var(--sidebar-w);
    flex: 1;
    padding: 14px 14px;
    overflow-y: auto;
    overflow-x: hidden;
}
.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 9px 13px;
    margin-bottom: 3px;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    transition: color 0.18s, background 0.18s, border-color 0.18s;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; fill: currentColor; opacity: 0.72; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.055); border-color: rgba(255,255,255,0.08); }
.nav-item.active {
    color: #f7db9b;
    background: linear-gradient(90deg, rgba(217,182,111,0.18), rgba(112,214,195,0.07));
    border-color: rgba(217,182,111,0.22);
    box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item.active svg { opacity: 1; }
.nav-label {
    padding: 16px 13px 7px;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: var(--sidebar-w);
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.025));
    border-top: 1px solid var(--border);
}
.user-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong) !important;
    font-size: 13px;
    font-weight: 900;
}
.user-info { min-width: 0; flex: 1; }
.user-name { color: #fff; font-size: 12px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { color: var(--text-dim); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-status { display: flex; align-items: center; gap: 5px; margin-top: 3px; color: var(--emerald); font-size: 10px; font-weight: 800; }
.status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 10px rgba(94,224,160,0.75); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: var(--text-dim);
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}
.sidebar-logout svg { width: 18px; height: 18px; fill: currentColor; }
.sidebar-logout:hover { color: var(--rose); background: var(--rose-glow); }

.main-content {
    flex: 1;
    min-height: 100vh;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), transparent 220px),
        var(--bg-main);
    transition: margin-left 0.32s cubic-bezier(0.4,0,0.2,1);
}
.sidebar.hidden ~ .main-content { margin-left: 0; }
.main-content > .card { margin: 24px 28px; }
.main-content > .card[style*="max-width"] { margin: 28px auto !important; }

.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--topbar-h);
    padding: 0 28px;
    background: rgba(13,17,24,0.78);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
}
.top-bar-left { display: flex; align-items: center; gap: 17px; min-width: 0; }
.hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    color: var(--text-muted);
    background: rgba(255,255,255,0.055);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.hamburger:hover { color: var(--accent); background: rgba(217,182,111,0.10); border-color: rgba(217,182,111,0.28); }
.hamburger svg { width: 20px; height: 20px; transition: transform 0.28s; }
.hamburger.active svg { transform: rotate(90deg); }
.page-title-wrap { min-width: 0; }
.page-title { color: #fff; font-size: 20px; font-weight: 900; letter-spacing: 0; }
.page-subtitle { margin-top: 2px; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.top-bar-date {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.045);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.date-text { color: var(--text-muted); font-size: 12px; font-weight: 700; }
.time-text { color: var(--accent); font-family: var(--mono); font-size: 11px; font-weight: 700; }

.alert {
    margin: 18px 28px 0;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    animation: slideIn 0.25s ease;
}
.alert-success { color: var(--emerald); background: var(--emerald-glow); border: 1px solid rgba(94,224,160,0.28); }
.alert-error { color: var(--rose); background: var(--rose-glow); border: 1px solid rgba(255,122,145,0.28); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 24px 28px 0;
}
.stat-card {
    position: relative;
    min-height: 132px;
    padding: 18px;
    overflow: hidden;
    background: rgba(255,255,255,0.045);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.045);
    transition: border-color 0.18s, background 0.18s;
}
.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: var(--card-accent, var(--accent));
    opacity: 0.55;
}
.stat-card:hover { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.06); }
.stat-emerald { --card-accent: var(--emerald); }
.stat-cyan { --card-accent: var(--cyan); }
.stat-purple { --card-accent: var(--purple); }
.stat-rose { --card-accent: var(--rose); }
.stat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.stat-icon-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.08);
}
.stat-icon-bg svg { width: 18px; height: 18px; }
.stat-icon-bg.emerald { color: var(--emerald); background: var(--emerald-glow); }
.stat-icon-bg.cyan { color: var(--cyan); background: var(--cyan-glow); }
.stat-icon-bg.purple { color: var(--purple); background: var(--purple-glow); }
.stat-icon-bg.rose { color: var(--rose); background: var(--rose-glow); }
.stat-label { color: var(--text-muted); font-size: 11px; font-weight: 900; letter-spacing: 0.03em; text-transform: uppercase; }
.stat-number { margin-bottom: 8px; color: #fff; font-size: 31px; font-weight: 900; line-height: 1; letter-spacing: 0; }
.stat-footer { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: var(--text-muted); font-size: 11px; font-weight: 700; }
.dot-emerald, .dot-rose { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot-emerald { background: var(--emerald); }
.dot-rose { background: var(--rose); margin-left: 6px; }
.stat-detail { color: var(--text-muted); font-size: 11px; font-weight: 700; }
.stat-detail-num { color: var(--accent); font-family: var(--mono); font-size: 13px; font-weight: 800; }
.sparkline { position: absolute; right: 14px; bottom: 11px; width: 90px; height: 24px; opacity: 0.28; }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 20px 28px 24px;
}
.dashboard-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.dashboard-sidebar,
.info-cards-row {
    display: none !important;
}
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255,255,255,0.045);
    backdrop-filter: blur(16px);
    overflow: hidden;
}
.card-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 14px 0;
    border-bottom: 1px solid var(--border);
}
.card-tab {
    position: relative;
    padding: 12px 14px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    transition: color 0.2s, background 0.2s;
}
.card-tab:hover { color: #fff; background: rgba(255,255,255,0.04); }
.card-tab.active { color: var(--accent); background: rgba(217,182,111,0.08); }
.card-tab.active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -1px;
    height: 2px;
    background: var(--accent);
}
.lic-tab-content { display: none; }
.lic-tab-content.active { display: block; }
.card-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.card-header-bar h2,
.card h2,
.card h3 { color: #fff; letter-spacing: 0; }
.search-form { display: flex; gap: 9px; min-width: 0; }
.search-input { width: 280px; }

.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table thead th {
    padding: 13px 16px;
    color: var(--text-dim);
    background: rgba(255,255,255,0.035);
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.055);
    color: var(--text);
    font-size: 13px;
    vertical-align: middle;
}
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.035); }
.data-table tbody tr:last-child td { border-bottom: none; }
.empty-row { padding: 36px 16px !important; color: var(--text-dim); text-align: center; }
.table-footer { padding: 13px 20px; border-top: 1px solid var(--border); text-align: center; }
.table-footer a { color: var(--accent); font-size: 13px; font-weight: 800; text-decoration: none; }
.table-footer a:hover { color: #f0d28a; }

.dashboard-table {
    min-width: 680px;
}
.dashboard-table tbody td {
    height: 58px;
    padding: 12px 16px;
    white-space: nowrap;
}
.dashboard-table td:nth-child(2) strong {
    display: block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dashboard-table td:last-child {
    text-align: right;
}
.dashboard-table .btn-sm {
    min-height: 32px;
    padding: 0 12px;
}
.dashboard-slot {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    color: var(--accent);
    background: rgba(217,182,111,0.08);
    border: 1px solid rgba(217,182,111,0.18);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 900;
}

.license-list-table {
    min-width: 860px;
    border-collapse: separate;
    border-spacing: 0;
}
.license-list-table thead,
.license-list-table tbody,
.license-list-table tr {
    display: block;
}
.license-list-table thead tr,
.license-list-table tbody tr {
    display: grid;
    grid-template-columns: minmax(170px, 1.2fr) 170px 130px 150px minmax(210px, 0.9fr);
    align-items: center;
}
.license-list-table th,
.license-list-table td {
    min-width: 0;
}
.license-list-table .empty-row {
    grid-column: 1 / -1;
}
.license-list-table td strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.license-koi-table tbody td:nth-child(3),
.license-koi-table tbody td:nth-child(6),
.license-koi-table tbody td:nth-child(7),
.license-j2me-table tbody td:nth-child(5) {
    display: none;
}
.license-koi-table tbody td:nth-child(2) { order: 1; }
.license-koi-table tbody td:nth-child(1) { order: 2; }
.license-koi-table tbody td:nth-child(5) { order: 3; }
.license-koi-table tbody td:nth-child(4) { order: 4; }
.license-koi-table tbody td:nth-child(8) { order: 5; }
.license-j2me-table tbody td:nth-child(2) { order: 1; }
.license-j2me-table tbody td:nth-child(1) { order: 2; }
.license-j2me-table tbody td:nth-child(4) { order: 3; }
.license-j2me-table tbody td:nth-child(3) { order: 4; }
.license-j2me-table tbody td:nth-child(6) { order: 5; }
.license-list-table .action-group {
    gap: 6px;
    justify-content: flex-start;
}
.license-list-table .action-group form {
    display: inline-flex !important;
}
.license-list-table .action-group .btn,
.license-list-table .action-group .btn-icon {
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 900;
}
.license-detail-source {
    display: none;
}

.code-tag {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    color: #f2d692;
    background: rgba(217,182,111,0.105);
    border: 1px solid rgba(217,182,111,0.24);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.035em;
}
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.075em;
    text-transform: uppercase;
}
.badge-active { color: var(--emerald); background: var(--emerald-glow); border: 1px solid rgba(94,224,160,0.28); }
.badge-expired { color: var(--rose); background: var(--rose-glow); border: 1px solid rgba(255,122,145,0.28); }
.device-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 220px;
    margin: 2px;
    padding: 4px 8px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
}
.legacy-detail-note {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 7px 10px;
    color: var(--accent);
    background: rgba(217,182,111,0.08);
    border: 1px solid rgba(217,182,111,0.24);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
}
.chip-x {
    padding: 0 3px;
    color: var(--rose);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    opacity: 0.7;
}
.chip-x:hover { opacity: 1; }
.action-group { display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; }
.role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.text-emerald { color: var(--emerald); }
.text-rose { color: var(--rose); }
.text-cyan { color: var(--cyan); }
.text-muted { color: var(--text-muted); }
.mono { font-family: var(--mono); font-weight: 800; }

.widget { padding: 16px; }
.widget h3, .info-card h3 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 13px;
    color: #fff;
    font-size: 13.5px;
    font-weight: 900;
}
.widget-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 34px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
    font-weight: 800;
}
.widget-row:last-child { border-bottom: none; }
.widget-row span:first-child { color: var(--text-muted); }
.shortcut-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    margin-top: 8px;
    padding: 10px 13px;
    color: var(--text);
    background: rgba(255,255,255,0.045);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 800;
    text-align: left;
    text-decoration: none;
    transition: transform 0.18s, background 0.18s, border-color 0.18s;
}
.shortcut-btn:first-of-type { margin-top: 0; }
.shortcut-btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.075); border-color: var(--border-strong); }
.shortcut-koi { color: var(--emerald); background: var(--emerald-glow); border-color: rgba(94,224,160,0.22); }
.shortcut-j2me { color: var(--purple); background: var(--purple-glow); border-color: rgba(169,145,255,0.24); }
.shortcut-neutral { color: var(--text-muted); }
.shortcut-neutral:hover { color: var(--text); }

.info-cards-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.info-card { padding: 16px; }
.role-list, .api-list, .security-list { display: flex; flex-direction: column; gap: 8px; }
.role-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 32px;
    padding: 3px 0;
}
.role-desc, .sec-item { color: var(--text-muted); font-size: 11.5px; font-weight: 750; line-height: 1.35; }
.api-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 4px 0;
}
.api-item code { color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 800; }
.api-desc {
    grid-column: 2;
    width: 100%;
    margin-top: -2px;
    color: var(--text-dim);
    font-size: 10.5px;
    line-height: 1.2;
}
.method-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    min-width: 43px;
    padding: 3px 7px;
    border-radius: var(--radius-sm);
    font-size: 9.5px;
    font-weight: 900;
    letter-spacing: 0.06em;
}
.method-badge.post { color: var(--emerald); background: var(--emerald-glow); }
.method-badge.get { color: var(--cyan); background: var(--cyan-glow); }
.sec-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    padding: 2px 0;
}
.sec-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; }
.sec-dot.green { background: var(--emerald); box-shadow: 0 0 10px rgba(94,224,160,0.55); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 20px 28px; }
.settings-grid .card {
    padding: 22px !important;
}
.settings-grid .card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px !important;
    color: #fff;
    font-size: 15px !important;
    font-weight: 900;
}
.settings-grid .card h3:not(:first-child) {
    margin-top: 20px !important;
}
.diag-grid { display: flex; flex-direction: column; gap: 10px; }
.diag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 38px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 13px;
    font-weight: 800;
}
.diag-item:last-child { border-bottom: none; }
.diag-item span:first-child { color: var(--text); }
.diag-item span:last-child {
    color: var(--text-muted);
    font-weight: 900;
    text-align: right;
}
.settings-grid .card > div[style*="display:flex"] {
    flex-wrap: wrap;
}
.settings-grid .card > div[style*="display:flex"] .btn {
    min-width: 86px;
}
.settings-grid form[method="POST"] {
    width: 100%;
    max-width: none !important;
}
.settings-grid form[method="POST"] .form-control {
    min-height: 44px;
    background: rgba(255,255,255,0.055);
}
.settings-grid form[method="POST"] .btn-purple {
    color: #12151d;
    background: linear-gradient(135deg, #f4d98f, #d2aa58);
    box-shadow: 0 12px 26px rgba(217,182,111,0.16);
}
.upload-sql-form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px !important;
    max-width: none !important;
}
.file-upload-box {
    position: relative;
    display: grid;
    gap: 3px;
    min-height: 56px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.045);
    border: 1px dashed rgba(217,182,111,0.34);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s;
}
.file-upload-box:hover {
    background: rgba(217,182,111,0.07);
    border-color: rgba(217,182,111,0.58);
}
.file-upload-box input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.file-upload-title {
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-upload-desc {
    color: var(--text-dim);
    font-size: 10.5px;
    font-weight: 700;
}
.lookup-result {
    padding: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.035));
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
}
.lookup-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.lookup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.lookup-grid > div {
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 6, 10, 0.72);
    backdrop-filter: blur(14px);
}
.modal-card {
    width: 100%;
    max-width: 456px;
    padding: 28px !important;
    animation: modalIn 0.22s ease;
    box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(255,255,255,0.06);
}
.modal-card.card {
    position: relative;
    background:
        linear-gradient(180deg, rgba(217,182,111,0.08), transparent 34%),
        rgba(12, 16, 24, 0.96);
    border-color: rgba(217,182,111,0.18);
}
.modal-card.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.modal-card h2 {
    color: #fff;
    font-size: 18px !important;
    font-weight: 900;
    letter-spacing: 0;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-form .field label {
    color: #b2bac8;
    font-size: 10.5px;
}
.modal-form .form-control {
    min-height: 44px;
    background-color: rgba(255,255,255,0.055);
    border-color: rgba(255,255,255,0.11);
}
.modal-form .form-control:focus {
    background-color: rgba(255,255,255,0.075);
    border-color: rgba(217,182,111,0.78);
}
.modal-actions .btn {
    min-width: 112px;
}
.modal-actions .btn-primary,
.modal-actions .btn-purple {
    color: #151006;
    background: linear-gradient(135deg, #f7df98, #c99d4d);
    border-color: rgba(246,223,155,0.48);
    box-shadow: 0 14px 30px rgba(217,182,111,0.16);
}
.modal-actions .btn-secondary {
    background: rgba(255,255,255,0.055);
    border-color: rgba(255,255,255,0.12);
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999;
    padding: 12px 18px;
    color: var(--emerald);
    background: var(--bg-panel-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
    font-size: 13px;
    font-weight: 800;
    animation: toastIn 0.24s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(4, 6, 10, 0.70);
    backdrop-filter: blur(14px);
}
.confirm-overlay.visible {
    display: flex;
}
.confirm-card {
    width: min(420px, 100%);
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(217,182,111,0.08), transparent 42%),
        rgba(13, 17, 25, 0.98);
    border: 1px solid rgba(217,182,111,0.20);
    border-radius: var(--radius);
    box-shadow: 0 34px 100px rgba(0,0,0,0.52), inset 0 1px 0 rgba(255,255,255,0.06);
    animation: confirmIn 0.18s ease;
}
@keyframes confirmIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.confirm-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #151006;
    background: linear-gradient(135deg, #f7df98, #c99d4d);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 18px;
    font-weight: 900;
    box-shadow: 0 12px 28px rgba(217,182,111,0.18);
}
.confirm-copy {
    min-width: 0;
}
.confirm-copy h2 {
    color: #fff;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.2;
}
.confirm-copy p {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1.45;
}
.confirm-target {
    margin-top: 10px;
    padding: 8px 10px;
    color: var(--accent);
    background: rgba(217,182,111,0.08);
    border: 1px solid rgba(217,182,111,0.18);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.confirm-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    padding-top: 4px;
}
.confirm-actions button {
    min-height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.12);
    cursor: pointer;
    font-family: var(--font);
    font-size: 12.5px;
    font-weight: 900;
}
.confirm-cancel {
    color: var(--text);
    background: rgba(255,255,255,0.055);
}
.confirm-cancel:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.18);
}
.confirm-approve {
    color: #151006;
    background: linear-gradient(135deg, #f7df98, #c99d4d);
    border-color: rgba(246,223,155,0.45);
}
.confirm-approve.danger {
    color: #fff;
    background: linear-gradient(135deg, #ff7a91, #c93455);
    border-color: rgba(255,122,145,0.42);
}

.license-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 450;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(4, 6, 10, 0.70);
    backdrop-filter: blur(14px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.license-detail-overlay.visible {
    display: flex;
}
.license-detail-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: calc(100vh - 36px);
    padding: 20px;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(217,182,111,0.09), transparent 38%),
        rgba(13, 17, 25, 0.98);
    border: 1px solid rgba(217,182,111,0.20);
    border-radius: var(--radius);
    box-shadow: 0 34px 100px rgba(0,0,0,0.52), inset 0 1px 0 rgba(255,255,255,0.06);
    animation: confirmIn 0.18s ease;
    overflow: hidden;
}
.license-detail-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 900;
}
.license-detail-close:hover {
    color: var(--rose);
    border-color: rgba(255,122,145,0.24);
    background: rgba(255,122,145,0.10);
}
.license-detail-head {
    padding-right: 44px;
    margin-bottom: 15px;
}
.license-detail-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.10em;
    text-transform: uppercase;
}
.license-detail-head h2 {
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.15;
}
.license-detail-code {
    display: inline-flex;
    margin-top: 9px;
    padding: 5px 9px;
    color: var(--accent);
    background: rgba(217,182,111,0.09);
    border: 1px solid rgba(217,182,111,0.20);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 900;
}
.license-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.license-detail-metric {
    padding: 10px;
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: var(--radius-sm);
}
.license-detail-metric span,
.license-detail-devices > span {
    display: block;
    margin-bottom: 5px;
    color: var(--text-dim);
    font-size: 9.5px;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}
.license-detail-metric strong {
    display: block;
    color: var(--text);
    font-size: 12px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.license-detail-devices {
    min-height: 0;
    max-height: min(46vh, 380px);
    margin-bottom: 13px;
    padding: 10px;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(217,182,111,0.45) rgba(255,255,255,0.05);
}
.license-detail-devices::-webkit-scrollbar {
    width: 8px;
}
.license-detail-devices::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
}
.license-detail-devices::-webkit-scrollbar-thumb {
    background: rgba(217,182,111,0.45);
    border-radius: 999px;
}
.license-detail-device-list .mobile-detail-value {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.license-detail-device-list .device-chip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    max-width: none;
    min-height: 44px;
    margin: 0;
    padding: 8px 10px;
    line-height: 1.35;
    white-space: normal;
}
.license-detail-actions {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.license-detail-actions form {
    display: flex !important;
    min-width: 0;
}
.license-detail-actions .detail-action,
.license-detail-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
}
.license-detail-actions .detail-action {
    color: var(--text);
    background: linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.045));
    border: 1px solid rgba(255,255,255,0.13);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.045);
    cursor: pointer;
}
.license-detail-actions .detail-action:hover {
    transform: none;
    border-color: rgba(217,182,111,0.30);
    background: rgba(217,182,111,0.10);
}
.license-detail-actions .detail-action-primary {
    color: #171106;
    background: linear-gradient(135deg, #f6df9b, #c99d4d);
    border-color: rgba(246,223,155,0.55);
    box-shadow: 0 10px 24px rgba(217,182,111,0.16);
}
.license-detail-actions .detail-action-danger {
    color: var(--rose);
    background: linear-gradient(180deg, rgba(255,122,145,0.13), rgba(255,122,145,0.08));
    border-color: rgba(255,122,145,0.28);
}
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 20px 28px;
    margin-top: auto;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    font-size: 12px;
    font-weight: 650;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0,0,0,0.58);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.25s;
}
.sidebar-overlay.visible { display: block; opacity: 1; }

.search-input-wrap { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.search-input-wrap .search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-dim);
    font-size: 13px;
    pointer-events: none;
}
.search-input-wrap .search-input { width: 100%; padding-left: 36px !important; padding-right: 32px !important; }
.search-input-wrap .search-clear {
    position: absolute;
    right: 9px;
    padding: 2px 6px;
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
}
.search-input-wrap .search-clear:hover { color: var(--rose); background: var(--rose-glow); }

@media (max-width: 1200px) {
    .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .info-cards-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    :root { --topbar-h: auto; }
    .sidebar {
        width: min(304px, 86vw) !important;
        transform: translateX(-100%);
        opacity: 1 !important;
        visibility: visible !important;
        transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
        z-index: 1000;
    }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: 18px 0 52px rgba(0,0,0,0.55); }
    .sidebar.hidden { width: min(304px, 86vw) !important; }
    .sidebar-brand,
    .sidebar-nav,
    .sidebar-user { min-width: 0; }
    .sidebar-brand {
        padding: 24px 18px 18px;
        gap: 12px;
    }
    .sidebar-logo {
        width: 42px;
        height: 42px;
    }
    .sidebar-title { font-size: 15.5px; }
    .sidebar-subtitle { font-size: 9.5px; }
    .sidebar-close-btn { display: flex; }
    .sidebar-nav {
        padding: 12px 12px;
    }
    .nav-label {
        padding: 17px 12px 7px;
        font-size: 9.5px;
        letter-spacing: 0.12em;
    }
    .nav-item {
        min-height: 42px;
        margin-bottom: 4px;
        padding: 10px 12px;
        gap: 12px;
        border-radius: 7px;
        font-size: 12.5px;
    }
    .nav-item svg {
        width: 18px;
        height: 18px;
    }
    .nav-item.active {
        box-shadow: inset 3px 0 0 var(--accent);
        background: linear-gradient(90deg, rgba(217,182,111,0.18), rgba(255,255,255,0.035));
    }
    .sidebar-user {
        padding: 14px;
        align-items: center;
        gap: 10px;
    }
    .user-avatar {
        width: 38px;
        height: 38px;
        font-size: 12px;
    }
    .user-name {
        font-size: 11.5px;
        line-height: 1.2;
    }
    .user-email,
    .user-status {
        font-size: 9.5px;
    }
    .sidebar-logout {
        width: 32px;
        height: 32px;
    }
    .main-content { width: 100%; margin-left: 0 !important; overflow-x: hidden; }
    .main-content > .card { margin: 14px; }
    .main-content > .card[style*="max-width"] { margin: 14px !important; }
    .top-bar { min-height: 58px; padding: 9px 12px; gap: 10px; }
    .top-bar-left { flex: 1; gap: 12px; }
    .page-title-wrap { flex: 1; }
    .page-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
    .page-subtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
    .hamburger { width: 38px; height: 38px; }
    .top-bar-date { padding: 6px 8px; }
    .date-text { display: none; }
    .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px 12px 0; }
    .stat-card {
        min-height: 94px;
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        align-items: center;
        column-gap: 8px;
        row-gap: 8px;
        padding: 12px;
    }
    .stat-card::before { opacity: 0.38; }
    .stat-card:hover { transform: none; }
    .stat-top {
        display: contents;
        margin: 0;
    }
    .stat-icon-bg {
        grid-column: 1;
        grid-row: 1;
        width: 36px;
        height: 36px;
    }
    .stat-icon-bg svg { width: 16px; height: 16px; }
    .stat-label {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 9px;
    }
    .stat-number {
        grid-column: 3;
        grid-row: 1;
        margin: 0;
        font-size: 25px;
        text-align: right;
    }
    .stat-footer {
        grid-column: 1 / -1;
        grid-row: 2;
        gap: 5px;
        font-size: 10px;
        white-space: nowrap;
    }
    .stat-detail {
        display: none;
    }
    .stat-detail-num {
        grid-column: 1 / -1;
        grid-row: 2;
        font-size: 10px;
        white-space: nowrap;
    }
    .stat-detail-num {
        transform: none;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .sparkline { display: none; }
    .dashboard-grid, .settings-grid { padding: 14px; gap: 14px; grid-template-columns: 1fr; }
    .dashboard-main .info-cards-row,
    .dashboard-sidebar {
        display: none;
    }
    .dashboard-main .card-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
        padding: 8px 8px 0;
        overflow: hidden;
    }
    .dashboard-main .card-tab {
        min-width: 0;
        padding: 11px 8px;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .dashboard-main .table-responsive {
        overflow-x: hidden;
    }
    .dashboard-main .data-table {
        counter-reset: license-row;
        min-width: 0;
        table-layout: fixed;
    }
    .dashboard-main #koi-tab .data-table th:nth-child(4),
    .dashboard-main #koi-tab .data-table td:nth-child(4),
    .dashboard-main #koi-tab .data-table th:nth-child(5),
    .dashboard-main #koi-tab .data-table td:nth-child(5),
    .dashboard-main #koi-tab .data-table th:nth-child(6),
    .dashboard-main #koi-tab .data-table td:nth-child(6),
    .dashboard-main #koi-tab .data-table th:nth-child(7),
    .dashboard-main #koi-tab .data-table td:nth-child(7),
    .dashboard-main #j2me-tab .data-table th:nth-child(4),
    .dashboard-main #j2me-tab .data-table td:nth-child(4),
    .dashboard-main #j2me-tab .data-table th:nth-child(5),
    .dashboard-main #j2me-tab .data-table td:nth-child(5),
    .dashboard-main #j2me-tab .data-table th:nth-child(6),
    .dashboard-main #j2me-tab .data-table td:nth-child(6) {
        display: none;
    }
    .dashboard-main .data-table th,
    .dashboard-main .data-table td {
        padding-left: 10px;
        padding-right: 10px;
    }
    .dashboard-main .data-table th:nth-child(1),
    .dashboard-main .data-table td:nth-child(1) { width: 36%; }
    .dashboard-main .data-table th:nth-child(2),
    .dashboard-main .data-table td:nth-child(2) { width: 38%; }
    .dashboard-main .data-table th:nth-child(3),
    .dashboard-main .data-table td:nth-child(3) { width: 26%; }
    .dashboard-main .data-table td:first-child > .btn-icon {
        display: none;
    }
    .dashboard-main .data-table tbody tr:not(.mobile-detail-row) {
        counter-increment: license-row;
        cursor: pointer;
    }
    .dashboard-main .data-table tbody tr:not(.mobile-detail-row) td:first-child {
        position: relative;
        padding-left: 34px;
    }
    .dashboard-main .data-table tbody tr:not(.mobile-detail-row) td:first-child::before {
        content: counter(license-row);
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        color: var(--accent);
        background: rgba(217,182,111,0.10);
        border: 1px solid rgba(217,182,111,0.22);
        border-radius: 50%;
        font-family: var(--mono);
        font-size: 9px;
        font-weight: 900;
    }
    .dashboard-main .data-table tbody tr.mobile-open-row {
        background: linear-gradient(90deg, rgba(217,182,111,0.08), rgba(255,255,255,0.025));
        box-shadow: inset 3px 0 0 rgba(217,182,111,0.72);
    }
    .dashboard-main .action-group {
        justify-content: flex-start;
        gap: 3px;
    }
    .dashboard-main .action-group form {
        display: inline-flex !important;
    }
    .dashboard-main .data-table td strong {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-detail-row td {
        display: table-cell !important;
        padding: 0 10px 12px !important;
        border-bottom: 1px solid rgba(255,255,255,0.08) !important;
        white-space: normal !important;
    }
    .mobile-detail-card {
        display: grid;
        gap: 0;
        position: relative;
        padding: 13px;
        background:
            linear-gradient(180deg, rgba(217,182,111,0.07), transparent 42%),
            rgba(8, 12, 19, 0.86);
        border: 1px solid rgba(217,182,111,0.18);
        border-radius: var(--radius-sm);
        box-shadow: 0 14px 36px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.055);
        overflow: hidden;
    }
    .mobile-detail-card::before {
        content: "Detail Lisensi";
        display: block;
        margin-bottom: 8px;
        color: var(--accent);
        font-size: 10px;
        font-weight: 900;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }
    .mobile-detail-item {
        display: grid;
        grid-template-columns: 86px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        min-width: 0;
        padding: 9px 0;
        border-bottom: 1px solid rgba(255,255,255,0.055);
    }
    .mobile-detail-item:first-child { padding-top: 0; }
    .mobile-detail-label {
        color: var(--text-dim);
        font-size: 9px;
        font-weight: 900;
        letter-spacing: 0.07em;
        text-transform: uppercase;
    }
    .mobile-detail-value {
        min-width: 0;
        color: var(--text);
        font-size: 12.5px;
        font-weight: 850;
    }
    .mobile-detail-value .device-chip {
        display: inline-flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        max-width: 100%;
        min-height: 34px;
        margin: 0 5px 5px 0;
        padding: 6px 7px 6px 9px;
        color: var(--text);
        background: linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.045));
        border-color: rgba(255,255,255,0.13);
        border-radius: var(--radius-sm);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
        white-space: normal;
    }
    .mobile-detail-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding-top: 13px;
    }
    .mobile-detail-actions .action-group {
        display: contents;
    }
    .mobile-detail-actions form { display: flex !important; min-width: 0; }
    .mobile-detail-actions .btn-icon,
    .mobile-detail-actions .btn,
    .detail-action {
        width: 100%;
        min-width: 0;
        height: 36px;
        padding: 0 9px;
        color: var(--text);
        background: linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.045));
        border: 1px solid rgba(255,255,255,0.13);
        border-radius: var(--radius-sm);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.045);
        font-size: 10.5px;
        font-weight: 900;
        letter-spacing: 0;
    }
    .detail-action:hover {
        transform: none;
        border-color: rgba(217,182,111,0.30);
        background: rgba(217,182,111,0.10);
    }
    .detail-action-primary {
        color: #171106;
        background: linear-gradient(135deg, #f6df9b, #c99d4d);
        border-color: rgba(246,223,155,0.55);
        box-shadow: 0 8px 20px rgba(217,182,111,0.15);
    }
    .detail-action-danger {
        color: var(--rose);
        background: linear-gradient(180deg, rgba(255,122,145,0.13), rgba(255,122,145,0.08));
        border-color: rgba(255,122,145,0.28);
    }
    .detail-device-remove {
        width: auto !important;
        min-width: 48px !important;
        height: 24px !important;
        margin-left: 2px;
        padding: 0 8px !important;
        color: var(--rose) !important;
        background: rgba(255,122,145,0.10) !important;
        border-color: rgba(255,122,145,0.22) !important;
        font-size: 9.5px !important;
    }
    .card-header-bar { flex-direction: column; align-items: stretch; gap: 11px; padding: 13px 14px; }
    .info-cards-row {
        gap: 10px;
    }
    .info-card,
    .widget {
        padding: 14px;
        border-color: rgba(255,255,255,0.10);
        background: rgba(13, 17, 25, 0.86);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
    }
    .info-card h3,
    .widget h3 {
        margin-bottom: 10px;
        font-size: 13px;
    }
    .role-list,
    .api-list,
    .security-list,
    .diag-grid {
        gap: 6px;
    }
    .role-item {
        grid-template-columns: 104px minmax(0, 1fr);
        min-height: 30px;
        gap: 8px;
    }
    .role-badge {
        justify-content: center;
        width: 100%;
        min-height: 25px;
        padding: 4px 6px;
        font-size: 9px;
    }
    .role-desc {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px;
    }
    .api-item {
        grid-template-columns: 44px minmax(0, 1fr);
        min-height: 36px;
        padding: 3px 0;
    }
    .api-item code {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11.5px;
    }
    .api-desc { font-size: 10px; }
    .sec-item { min-height: 25px; font-size: 11.5px; }
    .widget-row {
        min-height: 32px;
        padding: 6px 0;
        font-size: 11.5px;
    }
    .search-form { width: 100%; }
    .search-input { width: 100%; }
    .btn-create-main, .card-header-bar > .btn { width: 100%; }
    .alert {
        margin: 12px 14px 0;
        padding: 11px 13px;
        font-size: 12px;
    }
    .settings-grid {
        padding-top: 12px;
    }
    .settings-grid .card {
        padding: 16px !important;
    }
    .settings-grid .card h3 {
        margin-bottom: 12px !important;
        font-size: 14px !important;
    }
    .settings-grid .card h3:not(:first-child) {
        margin-top: 18px !important;
    }
    .diag-grid {
        gap: 0;
        padding: 2px 0;
    }
    .diag-item {
        min-height: 35px;
        padding: 7px 0;
        font-size: 12px;
    }
    .settings-grid .card > div[style*="display:flex"] {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px !important;
    }
    .settings-grid .card > div[style*="display:flex"] .btn {
        width: 100%;
        min-width: 0;
    }
    .settings-grid form[method="POST"] {
        gap: 10px !important;
    }
    .settings-grid form[method="POST"] .form-control {
        min-height: 42px;
        font-size: 12.5px;
    }
    .settings-grid form[method="POST"] .btn-purple {
        min-height: 42px;
        margin-top: 2px;
    }
    .upload-sql-form {
        grid-template-columns: 1fr;
    }
    .upload-sql-form .btn {
        width: 100%;
    }
    .app-footer { flex-direction: column; padding: 16px 14px; text-align: center; }
}

@media (max-width: 480px) {
    html { font-size: 13px; }
    .login-wrapper { padding: 14px; }
    .login-card { padding: 28px 22px; }
    .login-header h1 { font-size: 23px; }
    .hamburger { width: 36px; height: 36px; }
    .top-bar { padding: 8px 10px; }
    .page-title { font-size: 15px; }
    .page-subtitle { font-size: 10.5px; }
    .time-text { font-size: 10px; }
    .stats-row { padding: 10px 8px 0; gap: 8px; }
    .stat-card {
        min-height: 90px;
        grid-template-columns: 34px minmax(0, 1fr) auto;
        column-gap: 7px;
        padding: 10px;
    }
    .stat-icon-bg { width: 34px; height: 34px; }
    .stat-label { font-size: 8.5px; }
    .stat-number { font-size: 24px; }
    .stat-footer,
    .stat-detail-num { font-size: 9.5px; }
    .stat-detail-num { max-width: 100%; }
    .dashboard-grid, .settings-grid { padding: 10px; gap: 12px; }
    .settings-grid { padding-top: 10px; }
    .settings-grid .card { padding: 14px !important; }
    .settings-grid .card h3 { font-size: 13.5px !important; }
    .diag-item { min-height: 33px; font-size: 11.5px; }
    .main-content > .card { margin: 10px; }
    .main-content > .card[style*="max-width"] { margin: 10px !important; }
    .card-tabs { padding: 8px 8px 0; overflow-x: auto; }
    .card-tab { padding: 10px 11px; font-size: 12px; }
    .dashboard-main .card-tab { font-size: 11.5px; }
    .dashboard-main .data-table thead th { font-size: 9px; letter-spacing: 0.04em; }
    .dashboard-main .data-table tbody td { font-size: 11px; }
    .dashboard-main .code-tag { max-width: 82px; overflow: hidden; text-overflow: ellipsis; }
    .dashboard-main .btn-icon { min-width: 26px; height: 26px; padding: 0 5px; font-size: 11px; }
    .dashboard-main .mobile-detail-row td {
        white-space: normal !important;
    }
    .mobile-detail-item {
        grid-template-columns: 80px minmax(0, 1fr);
        gap: 8px;
    }
    .mobile-detail-actions .btn-icon,
    .mobile-detail-actions .btn {
        min-width: 32px;
        height: 30px;
    }
    .card-header-bar { padding: 11px 10px; }
    .search-form { gap: 7px; }
    .btn-search { min-width: 64px; padding: 8px 12px; font-size: 12px; }
    .data-table { min-width: 720px; }
    .license-list-table {
        min-width: 650px;
    }
    .license-list-table thead tr,
    .license-list-table tbody tr {
        grid-template-columns: 140px 128px 98px 110px 174px;
    }
    .license-list-table .action-group {
        gap: 5px;
    }
    .license-list-table .action-group .btn,
    .license-list-table .action-group .btn-icon {
        height: 30px;
        padding: 0 8px;
        font-size: 10px;
    }
    .data-table thead th { padding: 10px 12px; font-size: 10px; }
    .data-table tbody td { padding: 11px 12px; font-size: 12px; white-space: nowrap; }
    .code-tag { min-height: 24px; padding: 3px 7px; font-size: 11px; }
    .btn-icon { min-width: 30px; height: 30px; font-size: 12px; }
    .info-card, .widget { padding: 12px; }
    .info-card h3,
    .widget h3 { font-size: 12.5px; margin-bottom: 9px; }
    .role-item { grid-template-columns: 96px minmax(0, 1fr); }
    .role-desc { font-size: 10.5px; }
    .api-item { grid-template-columns: 42px minmax(0, 1fr); }
    .api-item code { font-size: 11px; }
    .sec-item,
    .widget-row { font-size: 11px; }
    .lookup-grid { grid-template-columns: 1fr; }
    .modal-overlay { padding: 10px; }
    .modal-card { padding: 20px 15px !important; }
    .modal-card h2 {
        margin-bottom: 16px !important;
        font-size: 16px !important;
    }
    .modal-form {
        gap: 13px;
    }
    .modal-form .form-control {
        min-height: 43px;
        font-size: 12.5px;
    }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn {
        width: 100%;
        min-height: 40px;
    }
    .confirm-overlay {
        align-items: center;
        padding: 12px;
    }
    .confirm-card {
        width: 100%;
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 12px;
        padding: 15px;
        border-radius: 10px;
    }
    .confirm-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .confirm-copy h2 {
        font-size: 15.5px;
    }
    .confirm-copy p {
        font-size: 12px;
    }
    .confirm-actions button {
        min-height: 42px;
    }
    .license-detail-overlay {
        align-items: center;
        padding: 12px;
    }
    .license-detail-card {
        width: 100%;
        max-height: calc(100vh - 24px);
        padding: 16px;
        border-radius: 10px;
    }
    .license-detail-head h2 {
        font-size: 17px;
    }
    .license-detail-grid {
        grid-template-columns: 1fr;
        gap: 7px;
    }
    .license-detail-metric {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 9px 10px;
    }
    .license-detail-metric span {
        margin-bottom: 0;
    }
    .license-detail-metric strong {
        text-align: right;
    }
    .license-detail-devices {
        max-height: 42vh;
        padding: 9px;
    }
    .license-detail-device-list .mobile-detail-value {
        display: grid;
        grid-template-columns: 1fr;
        gap: 7px;
    }
    .license-detail-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }
    .toast { left: 10px; right: 10px; bottom: 10px; text-align: center; }
}
