:root {
    --creka-ink: #162033;
    --creka-text: #27344a;
    --creka-muted: #718096;
    --creka-soft: #f6f8fc;
    --creka-surface: #ffffff;
    --creka-line: #e5eaf1;
    --creka-blue: #4263eb;
    --creka-blue-dark: #2f4fd1;
    --creka-mint: #16a394;
    --creka-danger: #dc4c64;
    --creka-warning: #e79a30;
    --creka-sidebar: #111a2e;
    --creka-radius: 16px;
    --creka-shadow: 0 12px 32px rgba(26, 39, 67, .07);
    --creka-sidebar-width: 248px;
}

html { background: var(--creka-soft); }
body#page-top,
body.creka-admin {
    min-height: 100vh;
    background: var(--creka-soft);
    color: var(--creka-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
    font-size: 15px;
    letter-spacing: -.012em;
}

/* Login */
body.login-page {
    min-height: 100vh;
    margin: 0;
    padding: 32px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 14% 15%, rgba(74, 222, 202, .16), transparent 31%),
        radial-gradient(circle at 88% 82%, rgba(66, 99, 235, .18), transparent 34%),
        #111a2e;
    color: #fff;
}
.login-layout { width: min(100%, 1080px); display: grid; grid-template-columns: minmax(0, 1fr) 420px; align-items: center; gap: clamp(56px, 8vw, 104px); }
.login-intro { min-width: 0; }
.login-intro h1 { max-width: 620px; margin: 20px 0 18px; font-size: clamp(2.75rem, 4vw, 4rem); font-weight: 850; line-height: 1.12; letter-spacing: -.06em; word-break: keep-all; }
.login-intro p { max-width: 560px; margin: 0; color: #b9c6da; font-size: 1rem; line-height: 1.75; word-break: keep-all; }
.login-badge { display: inline-flex; padding: 7px 12px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; color: #85ddd4; font-size: .71rem; font-weight: 850; letter-spacing: .14em; }
.login-card { width: 100% !important; max-width: none !important; margin: 0 !important; border: 1px solid rgba(255,255,255,.24); border-radius: 22px; background: #fff; box-shadow: 0 30px 80px rgba(0, 7, 24, .34); color: var(--creka-text); overflow: hidden; }
.login-card .card-header { display: flex; align-items: center; gap: 14px; padding: 30px 32px 12px; background: #fff; border: 0; }
.login-card .card-header div { display: flex; flex-direction: column; }
.login-card .card-header strong { color: var(--creka-ink); font-size: 1.2rem; letter-spacing: -.03em; }
.login-card .card-header small { margin-top: 3px; color: var(--creka-muted); font-weight: 650; }
.login-logo { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(145deg, #536ff0, #28b7aa); color: #fff; font-size: 1.4rem; font-weight: 900; box-shadow: 0 9px 22px rgba(66,99,235,.22); }
.login-card .card-body { padding: 20px 32px 32px; }
.login-card form { width: 100%; }
.login-form-group { width: 100%; margin: 0 0 15px; }
.login-form-group label { display: block; margin: 0 0 7px; color: #475569; font-size: .84rem; font-weight: 750; }
.login-card .login-form-group .form-control { width: 100%; height: 50px; min-height: 50px; padding: 0 15px; border: 1px solid #d5dce7; border-radius: 11px; background: #fbfcfe; color: var(--creka-ink); font-size: .96rem; }
.login-card .login-form-group .form-control:focus { border-color: var(--creka-blue); background: #fff; box-shadow: 0 0 0 4px rgba(66,99,235,.12); }
.login-card .login-form-group .form-control::placeholder { color: #9aa6b6; opacity: 1; }
.login-button { display: flex !important; width: 100% !important; height: 50px; align-items: center; justify-content: center; border: 0; border-radius: 11px; background: linear-gradient(135deg, #4968ed, #3658df); color: #fff; font-size: .95rem; font-weight: 800; box-shadow: 0 10px 22px rgba(66,99,235,.2); cursor: pointer; }
.login-button:hover, .login-button:focus { background: linear-gradient(135deg, #3f5fe2, #2f4fd1); color: #fff; transform: translateY(-1px); }
.login-help { margin: 17px 0 0; color: #94a3b8; font-size: .77rem; text-align: center; }

/* Desktop navigation */
.navbar.navbar-expand.bg-dark {
    position: fixed;
    z-index: 1050;
    inset: 0 auto 0 0;
    width: var(--creka-sidebar-width);
    min-height: 100vh;
    padding: 24px 16px 18px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    background: radial-gradient(circle at 15% 0, rgba(73, 104, 237, .22), transparent 30%), linear-gradient(180deg, #121d33, #10182a) !important;
    border: 0;
    box-shadow: 12px 0 36px rgba(13, 23, 42, .09);
}
.navbar-brand { width: 100%; margin: 0 !important; padding: 4px 8px 20px; display: flex; align-items: center; gap: 12px; color: #fff !important; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(145deg, #5976f5, #25b8a9); color: #fff; font-size: 1.25rem; font-weight: 900; box-shadow: 0 10px 25px rgba(24, 36, 72, .38); }
.brand-copy { min-width: 0; display: flex; flex-direction: column; }
.brand-copy strong { font-size: 1.02rem; line-height: 1.2; font-weight: 850; letter-spacing: -.025em; }
.brand-copy small { margin-top: 3px; color: #8494b1; font-size: .58rem; font-weight: 800; letter-spacing: .13em; }
#sidebarToggle { display: none !important; }
.navbar .primary-nav { width: 100%; margin: 16px 0 auto !important; display: flex; flex-direction: column; gap: 5px; }
.navbar .primary-nav .nav-item { width: 100%; }
.navbar .primary-nav .nav-link { width: 100%; min-height: 47px; margin: 0; padding: 0 13px !important; display: flex; align-items: center; gap: 12px; border-radius: 11px; color: #9daac1; font-size: .91rem; font-weight: 700; transition: background .18s ease, color .18s ease, transform .18s ease; }
.navbar .primary-nav .nav-link i { width: 22px; color: #7f8ca5; font-size: .95rem; text-align: center; }
.navbar .primary-nav .nav-link:hover { background: rgba(255,255,255,.055); color: #fff; transform: translateX(2px); }
.navbar .primary-nav .nav-item.active .nav-link { background: linear-gradient(135deg, rgba(83,111,240,.95), rgba(65,88,205,.92)); color: #fff; box-shadow: 0 8px 20px rgba(29,48,112,.28); }
.navbar .primary-nav .nav-item.active .nav-link i { color: #fff; }
.navbar > .navbar-nav:last-child { width: 100%; margin: 18px 0 0 !important; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.navbar > .navbar-nav:last-child .nav-item { width: 100%; }
.navbar .account-menu { min-height: 54px; padding: 7px 8px !important; display: flex; align-items: center; gap: 10px; border-radius: 12px; color: #c8d1e1; }
.navbar .account-menu:hover, .navbar .account-menu[aria-expanded="true"] { background: rgba(255,255,255,.055); color: #fff; }
.account-avatar { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 11px; background: #233252; color: #b8c6df; }
.account-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.account-copy strong { overflow: hidden; color: #eef3fb; font-size: .82rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { margin-top: 2px; color: #7f8da8; font-size: .68rem; }
.account-chevron { color: #6f7d96; font-size: .62rem; }
.navbar .dropdown-toggle::after { display: none; }
.navbar .dropdown-menu { min-width: 205px; padding: 8px; border: 1px solid var(--creka-line); border-radius: 13px; box-shadow: 0 18px 45px rgba(18,32,54,.18); }
.navbar .dropdown-item { padding: 9px 10px; border-radius: 8px; color: #4a5870; font-size: .84rem; }
.navbar .dropdown-item:hover { background: #f3f6fb; color: var(--creka-blue); }

/* Content shell */
#wrapper { display: block; min-height: 100vh; }
#wrapper > .sidebar { display: none !important; }
#wrapper #content-wrapper { width: calc(100% - var(--creka-sidebar-width)); min-height: 100vh; margin-left: var(--creka-sidebar-width); padding: 0; background: var(--creka-soft); }
.app-shell { min-height: 100vh; margin-left: var(--creka-sidebar-width); background: radial-gradient(circle at 96% 0, rgba(57, 199, 183, .09), transparent 30%), var(--creka-soft); }
.container-fluid { max-width: 1700px; margin: 0 auto; padding: 34px 34px 54px; }
.admin-main { max-width: 1600px; margin: 0 auto; padding-top: 38px; padding-bottom: 70px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-heading h1 { margin: 4px 0 7px; color: var(--creka-ink); font-size: 2rem; font-weight: 850; letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--creka-muted); font-size: .94rem; }
.eyebrow { color: var(--creka-blue); font-size: .69rem; font-weight: 900; letter-spacing: .16em; }

/* Cards and controls */
.card, .panel { border: 1px solid var(--creka-line); border-radius: var(--creka-radius); background: var(--creka-surface); box-shadow: var(--creka-shadow); overflow: hidden; }
.card-header { min-height: 66px; padding: 20px 24px; display: flex; align-items: center; gap: 8px; border: 0; border-bottom: 1px solid #edf0f5; background: #fff; color: var(--creka-ink); font-size: 1.03rem; font-weight: 820; }
.card-header > i { width: 31px; height: 31px; display: inline-grid; place-items: center; border-radius: 9px; background: #edf1ff; color: var(--creka-blue); font-size: .82rem; }
.card-body { padding: 22px 24px; }
.btn { min-height: 38px; padding: .48rem .78rem; border-radius: 9px; font-size: .84rem; font-weight: 750; box-shadow: none !important; }
.btn-sm { min-height: 32px; padding: .34rem .62rem; }
.btn-primary { border-color: var(--creka-blue); background: var(--creka-blue); }
.btn-primary:hover, .btn-primary:focus { border-color: var(--creka-blue-dark); background: var(--creka-blue-dark); }
.btn-info { border-color: #168f9c; background: #168f9c; }
.btn-danger { border-color: transparent; background: #fff0f2; color: #c83c55; }
.btn-danger:hover, .btn-danger:focus { border-color: var(--creka-danger); background: var(--creka-danger); color: #fff; }
.btn-outline-danger { border-color: #efb4be; color: #c83c55; }
.btn-light { border: 1px solid var(--creka-line); background: #fff; color: #526075; }
.form-control, .custom-select, select.form-control { min-height: 40px; height: 40px; border: 1px solid #d8dfe9; border-radius: 9px; background-color: #fff; color: var(--creka-text); font-size: .88rem; }
textarea.form-control { min-height: 100px; height: auto; }
.form-control:focus, .custom-select:focus { border-color: var(--creka-blue); box-shadow: 0 0 0 3px rgba(66,99,235,.11); }
label { color: #526075; font-size: .84rem; font-weight: 700; }
.badge { padding: .42em .65em; border-radius: 999px; font-weight: 750; }
.badge-soft { background: #eef2ff; color: #3d58c9; }
.modal-content { border: 0; border-radius: 17px; box-shadow: 0 24px 70px rgba(20,31,53,.28); }
.modal-header, .modal-footer { border-color: var(--creka-line); }
.modal-title { color: var(--creka-ink); font-weight: 800; }
.alert { border: 0; border-radius: 11px; }

/* Tables and DataTables */
.table-responsive { border-radius: 11px; overflow-x: auto !important; overflow-y: hidden; }
.table { margin: 0; color: var(--creka-text); font-size: .86rem; }
.table thead th { padding: .82rem .72rem; border-top: 0 !important; border-right: 0; border-bottom: 1px solid #dfe5ed !important; border-left: 0; background: #f7f9fc; color: #5e6b7f; font-size: .76rem; font-weight: 800; letter-spacing: .015em; vertical-align: middle; white-space: nowrap; }
.table td { padding: .76rem .72rem; border-top: 1px solid #edf0f4; border-right: 0; border-left: 0; vertical-align: middle; }
.table-bordered { border: 1px solid var(--creka-line); }
.table-hover tbody tr { transition: background .15s ease; }
.table-hover tbody tr:hover, .table tbody tr:hover { background: #f8faff; }
.table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--creka-blue); }
.dataTables_wrapper > .row:first-child { margin-bottom: 16px; align-items: center; }
.dataTables_wrapper > .row:last-child { margin-top: 16px; align-items: center; }
.dataTables_length label, .dataTables_filter label { margin: 0; display: inline-flex; align-items: center; gap: 8px; color: #647187; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.dataTables_length select { width: 72px !important; margin: 0 !important; }
.dataTables_filter { text-align: right; }
.dataTables_filter input { width: 190px !important; margin: 0 0 0 4px !important; }
.dataTables_info { padding-top: 7px !important; color: #778398; font-size: .8rem; }
.pagination { gap: 3px; }
.page-link { min-width: 34px; min-height: 34px; display: grid; place-items: center; padding: .35rem .55rem; border: 1px solid var(--creka-line); border-radius: 8px !important; color: #5c6a80; font-size: .78rem; }
.page-item.active .page-link { border-color: var(--creka-blue); background: var(--creka-blue); }
.input-group[style*="display: block"] { min-height: 42px; margin-top: 18px; }

/* Device and dashboard components */
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { padding: 19px 21px; border: 1px solid var(--creka-line); border-radius: 14px; background: linear-gradient(145deg, #fff, #f8faff); box-shadow: 0 8px 24px rgba(26,39,67,.04); }
.metric-card span { display: block; color: var(--creka-muted); font-size: .8rem; font-weight: 700; }
.metric-card strong { display: block; margin-top: 6px; color: var(--creka-ink); font-size: 1.75rem; line-height: 1; }
.metric-card.warning strong { color: var(--creka-warning); }
.filter-panel { padding: 16px; margin-bottom: 18px; }
.device-filter { display: grid; grid-template-columns: minmax(280px, 1fr) 170px 110px auto auto; gap: 9px; }
.search-field { display: flex; align-items: center; gap: 9px; margin: 0; padding: 0 13px; border: 1px solid #d8dfe9; border-radius: 9px; background: #fff; color: #9aa6b7; }
.search-field:focus-within { border-color: var(--creka-blue); box-shadow: 0 0 0 3px rgba(66,99,235,.1); }
.search-field input { width: 100%; height: 38px; border: 0; outline: 0; background: transparent; font-size: .87rem; }
.device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.device-card { border: 1px solid var(--creka-line); border-radius: 15px; background: #fff; box-shadow: 0 9px 26px rgba(26,39,67,.05); overflow: hidden; }
.device-card > header { display: flex; justify-content: space-between; gap: 18px; padding: 19px 20px 15px; border-bottom: 1px solid #edf0f5; }
.account-line { display: flex; align-items: center; gap: 8px; }
.account-line strong { color: var(--creka-ink); font-size: 1rem; }
.device-card header p { margin: 6px 0 3px; color: #526075; }
.device-card header small { color: #8a96a8; }
.capacity { min-width: 66px; height: 46px; display: flex; align-items: baseline; justify-content: center; gap: 3px; padding: 9px; border-radius: 12px; background: #eaf9f6; color: #087d70; }
.capacity.full { background: #fff0ed; color: #c74936; }
.capacity strong { font-size: 1.28rem; }
.capacity span { font-size: .75rem; }
.device-list { min-height: 74px; padding: 11px 20px; }
.device-row { display: flex; justify-content: space-between; align-items: center; padding: 8px; border-radius: 8px; }
.device-row:hover { background: #f6f8fc; }
.device-row i { width: 25px; color: var(--creka-blue); }
.device-row code { color: #3d4c64; font-size: .81rem; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: #9aa6b7; cursor: pointer; }
.icon-button:hover { background: #fff0f2; color: var(--creka-danger); }
.empty-device { padding: 15px 4px; color: #98a3b4; text-align: center; }
.device-card > footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 13px 20px; border-top: 1px solid #edf0f5; background: #fafbfc; }
.device-card footer label { display: flex; align-items: center; gap: 9px; margin: 0; color: #66738a; font-size: .78rem; font-weight: 700; }
.device-card footer select { width: 76px; }
.empty-result { grid-column: 1/-1; padding: 56px; color: #98a3b4; text-align: center; }
.password-panel { max-width: 620px; padding: 26px; }
.admin-toast { position: fixed; z-index: 2000; right: 24px; bottom: 24px; transform: translateY(20px); opacity: 0; padding: 13px 18px; border-radius: 11px; background: #17243d; color: #fff; box-shadow: 0 15px 40px rgba(15,23,42,.25); pointer-events: none; transition: .2s ease; }
.admin-toast.show { transform: translateY(0); opacity: 1; }
.admin-toast.error { background: #b93249; }

/* Activity page overrides for its legacy inline block */
.activity-hero { background: linear-gradient(135deg, #17223b, #304f91) !important; border-radius: 15px !important; box-shadow: 0 14px 32px rgba(31,54,99,.16) !important; }
.activity-hero h1 { font-weight: 850; letter-spacing: -.035em; }
.summary-card, .section-card { border: 1px solid var(--creka-line) !important; border-radius: 14px !important; box-shadow: 0 9px 26px rgba(26,39,67,.05) !important; }
.summary-value { color: var(--creka-ink) !important; }
.section-title { color: var(--creka-ink) !important; }
.notice-strip { border-left-color: var(--creka-blue) !important; background: #eef2ff !important; color: #405170 !important; }
.activity-pagination { border-color: var(--creka-line) !important; }

footer.sticky-footer { height: 70px; padding: 0; border-top: 1px solid var(--creka-line); background: #f3f5f9; color: #8a96a8; font-size: .74rem; }
.scroll-to-top { background: var(--creka-blue); }

@media (max-width: 1180px) {
    :root { --creka-sidebar-width: 220px; }
    .container-fluid { padding-right: 24px; padding-left: 24px; }
    .device-grid { grid-template-columns: 1fr; }
    .device-filter { grid-template-columns: minmax(220px,1fr) 150px 100px; }
    .device-filter .btn { width: 100%; }
}

/* Tablet and mobile navigation */
@media (max-width: 991.98px) {
    body#page-top, body.creka-admin { padding-top: 58px; font-size: 14px; }
    .navbar.navbar-expand.bg-dark { position: fixed; inset: 0 0 auto; width: 100%; min-height: 58px; height: 58px; padding: 0 9px; flex-direction: row; align-items: center; overflow: visible; box-shadow: 0 8px 24px rgba(15,23,42,.15); }
    .navbar-brand { width: auto; flex: 0 0 38px; padding: 0; }
    .brand-mark { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; font-size: 1rem; }
    .brand-copy { display: none; }
    .navbar .primary-nav { min-width: 0; width: auto; flex: 1 1 auto; flex-direction: row; gap: 2px; margin: 0 7px !important; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .navbar .primary-nav::-webkit-scrollbar { display: none; }
    .navbar .primary-nav .nav-item { width: auto; flex: 0 0 auto; }
    .navbar .primary-nav .nav-link { width: auto; min-height: 38px; padding: 0 9px !important; gap: 5px; border-radius: 9px; font-size: .74rem; white-space: nowrap; }
    .navbar .primary-nav .nav-link:hover { transform: none; }
    .navbar .primary-nav .nav-link i { width: auto; font-size: .72rem; }
    .navbar > .navbar-nav:last-child { width: 38px; flex: 0 0 38px; margin: 0 !important; padding: 0; border: 0; }
    .navbar .account-menu { min-height: 38px; padding: 2px !important; justify-content: center; }
    .account-avatar { width: 32px; height: 32px; flex-basis: 32px; border-radius: 10px; }
    .account-copy, .account-chevron { display: none; }
    .navbar .dropdown-menu { position: fixed; top: 52px; right: 8px; left: auto; }
    #wrapper #content-wrapper { width: 100%; margin-left: 0; }
    .app-shell { min-height: calc(100vh - 58px); margin-left: 0; }
    .admin-main { padding-top: 28px; }
    .container-fluid { padding: 24px 18px 44px; }
    .page-heading h1 { font-size: 1.7rem; }
    .device-filter { grid-template-columns: minmax(0,1fr) 150px 100px auto auto; }
    footer.sticky-footer { height: 58px; }
}

@media (max-width: 767.98px) {
    body#page-top, body.creka-admin { font-size: 13px; }
    .navbar.navbar-expand.bg-dark { padding: 0 6px; }
    .navbar-brand { flex-basis: 34px; }
    .brand-mark { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; font-size: .9rem; }
    .navbar .primary-nav { margin: 0 4px !important; }
    .navbar .primary-nav .nav-link { padding: 0 7px !important; font-size: .69rem; }
    .navbar .primary-nav .nav-link i { display: none; }
    .navbar > .navbar-nav:last-child { width: 32px; flex-basis: 32px; }
    .account-avatar { width: 29px; height: 29px; flex-basis: 29px; }
    .container-fluid, .admin-main { padding: 16px 10px 42px; }
    .page-heading { gap: 8px; margin-bottom: 16px; }
    .page-heading h1 { margin-bottom: 4px; font-size: 1.4rem; white-space: nowrap; }
    .page-heading p { max-width: calc(100vw - 20px); overflow-x: auto; font-size: .76rem; white-space: nowrap; scrollbar-width: none; }
    .eyebrow { font-size: .6rem; }
    .card, .panel { border-radius: 12px; }
    .card { margin-bottom: 12px !important; }
    .card-header { min-height: 52px; padding: 14px 15px; font-size: .9rem; white-space: nowrap; }
    .card-header > i { width: 27px; height: 27px; }
    .card-body { padding: 14px; }
    .table-responsive, .dataTables_wrapper { width: 100%; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .table-responsive > .table, .dataTables_wrapper .table { width: max-content !important; min-width: 100%; }
    .table th, .table td, .activity-table th, .activity-table td { padding: .56rem .52rem !important; font-size: .75rem !important; line-height: 1.25; white-space: nowrap !important; }
    .table td .subtle { font-size: .68rem; white-space: nowrap; }
    .dataTables_wrapper > .row { min-width: 100%; margin-right: 0; margin-left: 0; }
    .dataTables_length label, .dataTables_filter label, .dataTables_info, .dataTables_paginate { font-size: .72rem; }
    .dataTables_filter input { width: 110px !important; }
    .btn { min-height: 34px; padding: .4rem .58rem; font-size: .76rem; white-space: nowrap; }
    .form-control, .custom-select, select.form-control { min-height: 36px; height: 36px; padding: .35rem .48rem; font-size: .76rem; }
    label { font-size: .74rem; }
    .page-link { min-width: 31px; min-height: 31px; padding: .28rem .45rem; font-size: .72rem; }
    .metric-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; margin-bottom: 10px; }
    .metric-card { min-width: 0; padding: 11px 10px; }
    .metric-card span { font-size: .67rem; white-space: nowrap; }
    .metric-card strong { margin-top: 4px; font-size: 1.2rem; }
    .device-filter { grid-template-columns: 1fr 96px; gap: 6px; }
    .device-filter .search-field { grid-column: 1/-1; }
    .device-filter .btn { width: 100%; }
    .device-grid { grid-template-columns: 1fr; gap: 9px; }
    .device-card > header { padding: 13px; gap: 8px; }
    .device-card > header > div:first-child { min-width: 0; }
    .account-line, .device-card header p, .device-card header small { display: block; max-width: calc(100vw - 112px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .account-line strong { font-size: .86rem; }
    .capacity { min-width: 54px; height: 40px; padding: 7px; }
    .capacity strong { font-size: 1.03rem; }
    .capacity span { font-size: .65rem; }
    .device-list { min-height: 52px; padding: 7px 12px; }
    .device-row { padding: 6px; white-space: nowrap; }
    .device-row code { font-size: .73rem; }
    .device-card > footer { padding: 9px 12px; }
    .activity-hero { padding: 16px !important; margin-bottom: 11px !important; border-radius: 12px !important; }
    .activity-hero h1 { font-size: 1.1rem !important; white-space: nowrap; }
    .activity-hero p { overflow-x: auto; font-size: .73rem; white-space: nowrap; }
    .activity-summary-row { flex-wrap: nowrap; margin-right: -4px; margin-left: -4px; overflow-x: auto; scrollbar-width: none; }
    .activity-summary-row::-webkit-scrollbar { display: none; }
    .activity-summary-row > [class*="col-"] { width: 126px; flex: 0 0 126px; padding-right: 4px; padding-left: 4px; }
    .summary-card .card-body { padding: 11px !important; }
    .summary-label { font-size: .68rem !important; white-space: nowrap; }
    .summary-value { font-size: 1.12rem !important; white-space: nowrap; }
    .notice-strip { padding: 9px !important; overflow-x: auto; font-size: .7rem !important; white-space: nowrap; }
    .section-note { display: none; }
    .activity-pagination { padding: 9px 10px !important; overflow-x: auto; }
    .card-body > .row > .col-1 { max-width: 26%; flex: 0 0 26%; padding: 5px 4px; }
    .card-body > .row > .col-5 { max-width: 74%; flex: 0 0 74%; padding: 5px 4px; }
    .table-responsive > .row > .col-2 { max-width: 30%; flex: 0 0 30%; padding: 4px; }
    .table-responsive > .row > .col-8 { max-width: 70%; flex: 0 0 70%; padding: 4px; }
    #show-permission { width: 100px !important; }
    #search_name { width: calc(100% - 54px) !important; }
    .show_on_ani_uploaded input, .show_on_ani_subtitle_uploaded input, .show_on_desc_uploaded input, .show_on_desc_subtitle_uploaded input, .show_on_ending_uploaded input, .show_on_ending_subtitle_uploaded input { width: calc(100% - 50px) !important; }
    .modal-dialog { margin: .5rem; }
    .modal-header, .modal-body, .modal-footer { padding: .85rem; }
    .password-panel { padding: 16px; }
    footer.sticky-footer { height: 48px; font-size: .65rem; white-space: nowrap; }
    body.login-page { padding: 18px 12px; }
    .login-layout { width: min(100%, 420px); grid-template-columns: 1fr; gap: 18px; }
    .login-intro { overflow: hidden; text-align: center; }
    .login-intro h1 { margin: 10px 0 0; font-size: 1.18rem; white-space: nowrap; }
    .login-intro h1 br, .login-intro p { display: none; }
    .login-badge { padding: 5px 9px; font-size: .58rem; }
    .login-card { border-radius: 16px; }
    .login-card .card-header { padding: 20px 20px 8px; }
    .login-card .card-body { padding: 14px 20px 22px; }
    .login-logo { width: 42px; height: 42px; flex-basis: 42px; border-radius: 12px; font-size: 1.2rem; }
    .login-card .login-form-group .form-control { height: 44px; min-height: 44px; font-size: .82rem; }
    .login-button { height: 44px; font-size: .82rem; }
}

@media (max-width: 430px) {
    .navbar .primary-nav .nav-link { padding: 0 6px !important; font-size: .66rem; }
    .page-heading { flex-direction: column; }
    .metric-grid { gap: 5px; }
    .metric-card { padding: 10px 8px; }
}
