* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

a { color: #1890ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login & Install page - Premium Animated */
.login-page, .install-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #0a0e27;
}

/* Animated gradient backdrop */
.login-page::before,
.install-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(120, 119, 198, 0.35) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 119, 198, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.2) 0%, transparent 70%),
        linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    animation: bgShift 15s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes bgShift {
    0%   { filter: hue-rotate(0deg) brightness(1); }
    100% { filter: hue-rotate(30deg) brightness(1.1); }
}

/* Floating orbs */
.login-page::after,
.install-page::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(1px 1px at 60% 70%, rgba(255, 255, 255, 0.5), transparent),
        radial-gradient(1.5px 1.5px at 40% 80%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(2px 2px at 80% 20%, rgba(255, 255, 255, 0.5), transparent),
        radial-gradient(1px 1px at 90% 60%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(1.5px 1.5px at 10% 90%, rgba(255, 255, 255, 0.5), transparent),
        radial-gradient(1px 1px at 30% 50%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(2px 2px at 70% 40%, rgba(255, 255, 255, 0.4), transparent);
    background-size: 200% 200%;
    animation: drift 20s linear infinite;
    opacity: 0.7;
    z-index: 0;
}

@keyframes drift {
    0%   { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

/* Floating glow blobs (extra decor) */
.login-decor {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    z-index: 0;
    pointer-events: none;
}

.login-decor.b1 {
    width: 420px;
    height: 420px;
    background: #6366f1;
    top: -120px;
    left: -120px;
    animation: floatA 14s ease-in-out infinite alternate;
}

.login-decor.b2 {
    width: 380px;
    height: 380px;
    background: #ec4899;
    bottom: -100px;
    right: -100px;
    animation: floatB 16s ease-in-out infinite alternate;
}

.login-decor.b3 {
    width: 260px;
    height: 260px;
    background: #8b5cf6;
    top: 40%;
    left: 60%;
    animation: floatC 12s ease-in-out infinite alternate;
}

@keyframes floatA {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 80px) scale(1.15); }
}

@keyframes floatB {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-80px, -40px) scale(1.1); }
}

@keyframes floatC {
    0%   { transform: translate(0, 0) scale(0.9); }
    100% { transform: translate(-40px, 60px) scale(1.15); }
}

/* Glass card */
.login-container, .install-container {
    position: relative;
    width: 420px;
    padding: 48px 40px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    animation: cardIn 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cardIn {
    0%   { opacity: 0; transform: translateY(30px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Animated border glow */
.login-container::before,
.install-container::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 22px;
    padding: 2px;
    background: conic-gradient(from var(--angle, 0deg),
        transparent 0deg,
        rgba(139, 92, 246, 0.8) 90deg,
        rgba(236, 72, 153, 0.8) 180deg,
        rgba(99, 102, 241, 0.8) 270deg,
        transparent 360deg);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: rotate 6s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes rotate {
    to { --angle: 360deg; }
}

/* Fallback for browsers without @property */
@supports not (background: conic-gradient(from var(--angle), red, blue)) {
    .login-container::before,
    .install-container::before {
        display: none;
    }
}

.login-container h1, .install-container h1 {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.install-container h2 {
    text-align: center;
    font-size: 14px;
    font-weight: 400;
    color: rgba(226, 232, 240, 0.75);
    margin-bottom: 28px;
}

/* Premium form inputs */
.login-page .form-group,
.install-page .form-group { margin-bottom: 18px; position: relative; }

.login-page .form-group label,
.install-page .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: rgba(226, 232, 240, 0.85);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.login-page input[type=text],
.login-page input[type=password],
.login-page input[type=number],
.login-page input[type=url],
.login-page textarea,
.login-page select,
.install-page input[type=text],
.install-page input[type=password],
.install-page input[type=number],
.install-page input[type=url],
.install-page textarea,
.install-page select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.25s ease;
    outline: none;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.login-page input::placeholder,
.install-page input::placeholder,
.login-page textarea::placeholder,
.install-page textarea::placeholder {
    color: rgba(226, 232, 240, 0.45);
}

.login-page input:focus,
.login-page textarea:focus,
.install-page input:focus,
.install-page textarea:focus {
    border-color: rgba(139, 92, 246, 0.7);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

/* Premium primary button */
.login-page .btn-primary,
.install-page .btn-primary {
    width: 100%;
    padding: 12px 16px;
    margin-top: 8px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    background-size: 200% 200%;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
    transition: all 0.3s ease;
    animation: btnShift 6s ease infinite;
}

@keyframes btnShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

.login-page .btn-primary:hover,
.install-page .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5);
}

.login-page .btn-primary:active,
.install-page .btn-primary:active {
    transform: translateY(0);
}

/* Messages on dark bg */
.login-page .message,
.install-page .message {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 13px;
    text-align: center;
    border: 1px solid transparent;
}

.login-page .message.success,
.install-page .message.success {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.3);
}

.login-page .message.error,
.install-page .message.error {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.tip {
    text-align: center;
    margin-top: 24px;
    color: rgba(226, 232, 240, 0.6);
    font-size: 12px;
}

.tip a { color: #c7d2fe; }
.tip a:hover { color: #fff; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #4b5563;
    font-weight: 500;
}

input[type=text], input[type=password], input[type=number], input[type=url], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
    outline: none;
    background: #fff;
}

input:focus, textarea:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

textarea { resize: vertical; font-family: "Courier New", monospace; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.15s;
}

.btn:hover { background: #e5e7eb; text-decoration: none; color: #1f2937; }
.btn-primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.btn-primary:hover { background: #40a9ff; border-color: #40a9ff; color: #fff; }
.btn-danger { background: #f5222d; color: #fff; border-color: #f5222d; }
.btn-danger:hover { background: #ff4d4f; border-color: #ff4d4f; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 10px; font-size: 12px; }
button.btn { margin-right: 8px; }

/* Layout */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 200px;
    height: 100vh;
    background: #1f2937;
    color: #d1d5db;
    padding: 0;
    overflow-y: auto;
}

.logo {
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid #374151;
}

.nav {
    padding: 12px 0;
    flex: 1;
}

.nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #9ca3af;
    text-decoration: none;
    border-left: 3px solid transparent;
    font-size: 14px;
    transition: all 0.2s;
    gap: 10px;
}
.nav a:hover { background: #374151; color: #fff; text-decoration: none; }
.nav a.active { background: #111827; color: #fff; border-left-color: #1890ff; }
.nav-icon {
    font-size: 16px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-footer .logout {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid #374151;
    margin-top: auto;
}

.sidebar-footer .logout {
    display: block;
    padding: 8px 12px;
    text-align: center;
    background: #374151;
    color: #d1d5db;
    border-radius: 6px;
    font-size: 13px;
}

.sidebar-footer .logout:hover { background: #f5222d; color: #fff; text-decoration: none; }

.main {
    margin-left: 200px;
    min-height: 100vh;
}

.header {
    background: #fff;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title { font-size: 18px; font-weight: 600; color: #1f2937; }
.header-user { font-size: 13px; color: #6b7280; }

.content { padding: 24px; }

/* Cards */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title { font-size: 15px; font-weight: 600; color: #1f2937; }

.card-tools { display: flex; align-items: center; gap: 8px; }

.card-body { padding: 20px; }

.search-form { display: flex; align-items: center; gap: 8px; }
.search-form input { width: 180px; padding: 6px 10px; font-size: 13px; }

.alert {
    padding: 12px 16px;
    background: #e6f7ff;
    border: 1px solid #91d5ff;
    border-radius: 6px;
    margin-bottom: 16px;
    color: #0050b3;
    font-size: 14px;
}

.alert-warn {
    background: #fff7e6;
    border-color: #ffd591;
    color: #d46b08;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-label { font-size: 13px; color: #6b7280; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 600; color: #1f2937; }

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    background: #f9fafb;
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: #4b5563;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}

.table tbody tr:hover { background: #fafbfc; }

.phone-number { font-family: "Courier New", monospace; font-weight: 500; }

.verification-code {
    display: inline-block;
    padding: 4px 10px;
    background: #e6f7ff;
    color: #0050b3;
    border-radius: 4px;
    font-family: "Courier New", monospace;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    letter-spacing: 1px;
    transition: all 0.15s;
}

.verification-code:hover {
    background: #1890ff;
    color: #fff;
}

.msg-cell {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #6b7280;
}

.time-cell { color: #6b7280; font-size: 12px; white-space: nowrap; }

.link-small {
    font-size: 12px;
    color: #1890ff;
    word-break: break-all;
    display: inline-block;
    max-width: 300px;
}

.room-name {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 12px;
    color: #4b5563;
}

.status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.status-active { background: #d4edda; color: #155724; }
.status-off { background: #f8d7da; color: #721c24; }

.tag {
    display: inline-block;
    padding: 2px 8px;
    background: #e5e7eb;
    color: #374151;
    border-radius: 4px;
    font-size: 12px;
}

.empty {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
    font-size: 14px;
}

.hint {
    background: #fafbfc;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.hint code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    color: #d63384;
    font-family: "Courier New", monospace;
}

/* Form horizontal */
.form-horizontal .form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.form-horizontal .form-col { flex: 1; min-width: 200px; }
.form-horizontal .form-col label { display: block; margin-bottom: 6px; font-size: 13px; color: #4b5563; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 0 0;
}

.pagination a {
    padding: 6px 14px;
    background: #f3f4f6;
    border-radius: 4px;
    color: #4b5563;
    font-size: 13px;
}

.pagination a:hover { background: #e5e7eb; text-decoration: none; color: #1f2937; }
.pagination span { color: #9ca3af; font-size: 13px; }

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #1f2937;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s;
    pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { background: #52c41a; }
.toast.error { background: #f5222d; }

.refresh-icon { display: inline-block; font-size: 14px; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 100%; height: auto; position: static; }
    .main { margin-left: 0; }
    .stats { grid-template-columns: 1fr; }
}
