:root {
    --bg-primary: #050505;
    --bg-secondary: #0a0a0a;
    --bg-card: #111111;
    --bg-hover: #1a1a1a;
    --bg-elevated: #222222;
    --text-primary: #ffffff;
    --text-secondary: #b5b5b5;
    --text-muted: #747474;
    --border: rgba(255, 255, 255, 0.09);
    --border-hover: rgba(255, 255, 255, 0.18);
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #ef5350;
    --radius: 8px;
    --radius-lg: 10px;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
    --transition: 180ms ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    min-height: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body:not(.login-body) {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
}

a {
    color: var(--text-primary);
}

.noise {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.025;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.title-bar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 20;
    min-height: 56px;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: rgba(5, 5, 5, 0.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
}

.title-bar-left {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    object-fit: contain;
}

.brand-name {
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.server-badge,
.live-badge {
    flex: 0 0 auto;
    padding: 4px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.app-container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
    padding-top: 56px;
}

.sidebar {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.nav-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.nav-header {
    display: none;
}

.nav-item,
.stat-pill {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    padding: 8px 11px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    white-space: nowrap;
}

.nav-item:hover,
.nav-item.active {
    border-color: var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.nav-icon,
.section-icon {
    width: 16px;
    height: 16px;
    object-fit: contain; 
}  

.nav-badge {
    min-width: 23px;
    padding: 2px 7px;
    border: 1px solid rgba(255, 80, 80, 0.28);
    border-radius: 999px;
    background: rgba(255, 80, 80, 0.14);
    color: #ff7777;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}

.nav-stats {
    display: none;
}

.main-content {
    min-width: 0;
    overflow-y: auto;
    padding: 20px 16px 28px;
}

.main-content::-webkit-scrollbar,
.pc-selector::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-thumb,
.pc-selector::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

.tab-content {
    width: 100%;
}

.page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.eyebrow {
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.page-title {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.15;
}

.page-note,
.empty-note,
.field-help {
    color: var(--text-muted);
    font-size: 12px;
}

.page-note {
    margin: -6px 0 18px;
}

.header-actions,
.toolbar-actions,
.form-actions,
.modal-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-connected {
    border: 1px solid rgba(76, 175, 80, 0.32);
    background: rgba(76, 175, 80, 0.15);
    color: var(--success);
}

.status-disconnected {
    border: 1px solid rgba(244, 67, 54, 0.3);
    background: rgba(244, 67, 54, 0.14);
    color: #f66b62;
}

.toolbar {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.section-title,
.column-title,
.panel-title {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-title,
.panel-title {
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.panel-title {
    color: var(--text-primary);
    font-size: 15px;
    text-transform: none;
    letter-spacing: 0;
}

.panel,
.pc-card,
.template-card,
.send-template-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
}

.panel {
    width: 100%;
    padding: 18px;
}

.settings-panel,
.edit-panel,
.template-list,
.send-template-list {
    max-width: 760px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.pcs-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.pc-card {
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.pc-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.pc-card.offline {
    opacity: 0.62;
}

.preview-container {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 100%;
    overflow: hidden;
    background: #020202;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 240ms ease;
}

.preview-container:hover .preview-image {
    transform: scale(1.015);
}

.preview-placeholder,
.screen-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 22px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.preview-placeholder-icon,
.empty-state-icon-img,
.template-icon-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    opacity: 0.7;
}

.preview-status,
.preview-fps,
.connection-info,
.fps-counter {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.72);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    backdrop-filter: blur(8px);
}

.preview-status {
    top: 10px;
    left: 10px;
}

.preview-status.online {
    color: var(--success);
}

.preview-status.offline {
    color: #f66b62;
}

.preview-fps {
    top: 10px;
    right: 10px;
    color: var(--success);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: currentColor;
}

.status-dot-muted {
    color: var(--text-muted);
}

.preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.58);
    opacity: 0;
    transition: opacity var(--transition);
}

.preview-container:hover .preview-overlay {
    opacity: 1;
}

.preview-btn {
    min-height: 40px;
    padding: 9px 16px;
    border-radius: var(--radius);
    background: var(--text-primary);
    color: var(--bg-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.pc-info {
    padding: 14px;
}

.pc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.pc-title-block {
    min-width: 0;
}

.pc-name {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 800;
}

.pc-ip {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.pc-header-actions {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}

.pc-manage-btn {
    min-height: 30px;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.pc-manage-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.pc-manage-btn.delete:hover {
    border-color: rgba(255, 80, 80, 0.32);
    background: rgba(255, 80, 80, 0.12);
    color: #ff7777;
}

.pc-game {
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    padding: 3px 9px;
    margin: -4px 0 12px;
    border-radius: 999px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.stat-item {
    min-width: 0;
    padding: 9px 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    text-align: center;
}

.stat-label {
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.stat-value {
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.stat-value-small {
    font-size: 14px;
}

.stat-value.warning {
    color: var(--warning);
}

.stat-value.danger {
    color: var(--danger);
}

.pc-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, minmax(42px, auto));
    gap: 7px;
}

.offline-note { 
    color: var(--text-muted);
    font-size: 12px; 
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 5px;
} 

.btn,
.icon-btn,
.type-btn,
.target-btn,
.view-btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.btn:hover,
.icon-btn:hover {
    transform: translateY(-1px);
}

.btn-primary,
.target-btn.active,
.type-btn.active {
    border-color: var(--text-primary);
    background: var(--text-primary);
    color: var(--bg-primary);
}

.btn-secondary,
.btn-remote,
.btn-lock,
.icon-btn {
    border-color: var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.btn-secondary:hover,
.btn-remote:hover,
.btn-lock:hover,
.icon-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-remote.active {
    background: #ff6f00;
    border-color: #ff6f00;
    color: #ffffff;
    animation: pulse 2s infinite;
}

.btn-danger {
    border-color: rgba(255, 80, 80, 0.32);
    background: rgba(255, 80, 80, 0.08);
    color: #ff7777;
}

.btn-danger:hover {
    background: rgba(255, 80, 80, 0.16);
    color: #ffffff;
}

.btn-full {
    width: 100%;
}

.view-toggle,
.segmented-control {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 4px;
    width: 100%;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
}

.view-btn,
.type-btn,
.target-btn {
    min-width: 0;
    background: transparent;
    color: var(--text-secondary);
}

.view-btn.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.preview-toggle {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.toggle-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #303030;
    cursor: pointer;
    transition: background var(--transition);
}

.toggle-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform var(--transition);
}

.toggle-switch.active {
    background: var(--success);
}

.toggle-switch.active::after {
    transform: translateX(18px);
}

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

.form-label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: 0;
    background: var(--bg-hover);
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color var(--transition), background var(--transition);
}

textarea.form-input {
    min-height: 108px;
    resize: vertical;
}

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

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input.is-disabled,
.form-input:disabled {
    color: var(--text-muted);
    background: var(--bg-primary);
}

.field-help {
    display: block;
    margin-top: 6px;
}

.template-list,
.send-template-list {
    display: grid;
    gap: 10px;
}

.template-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    transition: border-color var(--transition);
}

.template-card:hover,
.send-template-item:hover {
    border-color: var(--border-hover);
}

.template-icon,
.template-type-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.template-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: var(--bg-hover);
}

.template-content {
    min-width: 0;
}

.template-title,
.send-template-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.template-text,
.send-template-preview {
    color: var(--text-secondary);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.template-actions {
    display: flex;
    grid-column: 1 / -1;
    gap: 8px;
}

.template-actions .template-btn {
    flex: 1;
}

.template-btn {
    min-height: 34px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.template-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.template-btn.delete:hover {
    border-color: rgba(255, 80, 80, 0.32);
    background: rgba(255, 80, 80, 0.12);
    color: #ff7777;
}

.send-layout {
    display: grid;
    gap: 18px;
    max-width: 980px;
}

.send-column {
    min-width: 0;
}

.send-template-item {
    display: grid;
    gap: 8px;
    padding: 14px;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.send-template-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.template-type-chip {
    margin-left: auto;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.template-type-chip.info {
    background: rgba(33, 150, 243, 0.14);
    color: #64b5f6;
}

.template-type-chip.warning {
    background: rgba(255, 152, 0, 0.14);
    color: var(--warning);
}

.template-type-chip.error {
    background: rgba(244, 67, 54, 0.14);
    color: #ff7777;
}

.pc-selector {
    max-height: 160px;
    overflow-y: auto;
    margin-top: 10px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
}

.pc-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
}

.pc-select-item:hover,
.pc-select-item.selected {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pc-select-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--text-muted);
}

.pc-select-item.selected .pc-select-dot {
    background: var(--success);
}

.pc-select-game {
    margin-left: auto;
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    min-height: 280px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 32px 18px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    text-align: center;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.96);
}

.modal-overlay.active {
    display: flex;
}

.modal-header {
    display: grid;
    gap: 10px;
    flex: 0 0 auto;
}

.modal-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.screen-container {
    position: relative;
    min-height: 0;
    flex: 1;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #000000;
}

.screen-view {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: crosshair;
}

.connection-info {
    top: 10px;
    left: 10px;
}

.fps-counter {
    top: 10px;
    right: 10px;
    color: var(--success);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.toast-container {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 999;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 28px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(20, 20, 20, 0.96);
    box-shadow: var(--shadow);
    color: var(--text-primary);
    transform: translateY(18px);
    opacity: 0;
    transition: transform 220ms ease, opacity 220ms ease;
    pointer-events: all;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    font-weight: 800;
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error .toast-icon {
    color: var(--danger);
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 22px;
}

.login-wrapper {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
}

.login-card {
    padding: 34px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow);
    text-align: center;
}

.login-logo {
    width: 74px;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-hover);
}

.login-logo img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.login-title {
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 23px;
    font-weight: 800;
}

.login-subtitle {
    margin-bottom: 28px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.input-group {
    margin-bottom: 18px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.input-group input {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.input-group input:focus {
    border-color: var(--text-primary);
    background: var(--bg-hover);
}

.login-btn {
    width: 100%;
    min-height: 46px;
    border-radius: var(--radius);
    background: var(--text-primary);
    color: var(--bg-primary);
    cursor: pointer;
    font-weight: 800;
}

.login-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.error {
    min-height: 0;
    margin-top: 14px;
    padding: 0;
    border: 0;
    color: var(--danger);
    font-size: 13px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity var(--transition), transform var(--transition), padding var(--transition), border-color var(--transition);
}

.error.show {
    padding: 11px 13px;
    border: 1px solid rgba(244, 67, 54, 0.24);
    border-radius: var(--radius);
    background: rgba(244, 67, 54, 0.1);
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.76;
    }
}

.animate-in {
    animation: fadeIn 360ms ease forwards;
}

.delay-1 {
    animation-delay: 70ms;
}

.delay-2 {
    animation-delay: 120ms;
}

@media (min-width: 560px) {
    .page-header,
    .toolbar,
    .modal-header {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .page-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .toolbar {
        display: grid;
        align-items: center;
    }

    .toolbar-actions {
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

    .preview-toggle,
    .view-toggle {
        width: auto;
    }

    .pcs-grid {
        grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
        gap: 16px;
    }

    .pcs-grid.compact {
        grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    }

    .template-card {
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: start;
    }

    .template-actions {
        grid-column: auto;
        flex-direction: row;
    }

    .template-actions .template-btn {
        flex: 0 0 auto;
    }

    .modal-header {
        display: grid;
        align-items: center;
    }
}

@media (min-width: 900px) {
    .app-container {
        grid-template-columns: 248px minmax(0, 1fr);
        grid-template-rows: 1fr;
    }

    .sidebar {
        flex-direction: column;
        gap: 4px;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 22px 14px;
        border-right: 1px solid var(--border);
        border-bottom: 0;
    }

    .nav-section {
        display: block;
        margin-bottom: 22px;
    }

    .nav-header {
        display: block;
        margin: 0 0 8px;
        padding: 0 10px;
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 1.5px;
        text-transform: uppercase;
    }

    .nav-item,
    .stat-pill {
        width: 100%;
        margin-bottom: 4px;
    }

    .nav-item.active {
        position: relative;
    }

    .nav-item.active::before {
        content: "";
        position: absolute;
        left: -1px;
        top: 50%;
        width: 3px;
        height: 18px;
        border-radius: 0 2px 2px 0;
        background: #ffffff;
        transform: translateY(-50%);
    }

    .nav-stats {
        display: block;
        margin-top: auto;
        margin-bottom: 0;
    }

    .stat-pill {
        cursor: default;
        background: rgba(255, 255, 255, 0.025);
    }

    .main-content {
        padding: 30px 32px;
    }

    .send-layout {
        grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr);
        gap: 24px;
    }
}

@media (min-width: 1200px) {
    .app-container {
        grid-template-columns: 268px minmax(0, 1fr);
    }

    .pcs-grid {
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 380px) {
    .brand-name {
        max-width: 170px;
        letter-spacing: 1px;
    }

    .server-badge {
        display: none;
    }

    .pc-actions {
        grid-template-columns: 1fr;
    }

    .stats-bar {
        grid-template-columns: 1fr;
    }
}
