@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --bg-input: #141414;
    --accent: #39ff14;
    --accent-hover: #7fff5c;
    --accent-subtle: rgba(57, 255, 20, 0.15);
    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;
    --border: #2e2e2e;
    --border-focus: #39ff14;
    --success: #22c55e;
    --error: #ef4444;
    --radius-sm: 12px;
    --radius: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-pill: 999px;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --card-bg: rgba(30, 30, 45, 1);
    --drawer-bg: #1a1a1a;
    --scrollbar-track: rgba(255, 255, 255, 0.04);
    --scrollbar-thumb: rgba(255, 255, 255, 0.14);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.24);
    --app-shell-gap: 24px;
    --app-shell-pad-y: 20px;
    --app-shell-pad-x: 40px;
    --panel-pad: 20px;
    --analysis-input-min-height: 180px;
    --output-min-height: 300px;
}

:root[data-theme='light'] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f9fafb;
    --bg-input: #ffffff;
    --accent: #0d9f6e;
    --accent-hover: #0a8c62;
    --accent-subtle: rgba(13, 159, 110, 0.15);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-focus: #0d9f6e;
    --success: #10b981;
    --error: #ef4444;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --card-bg: #ffffff;
    --drawer-bg: #ffffff;
    --scrollbar-track: rgba(15, 23, 42, 0.05);
    --scrollbar-thumb: rgba(100, 116, 139, 0.28);
    --scrollbar-thumb-hover: rgba(100, 116, 139, 0.42);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--bg-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-align: center;
    min-height: 100vh;
    line-height: 1.5;
    position: relative;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    border: 2px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

#matrix-bg canvas {
    display: block;
    pointer-events: none;
}

.app-wrapper {
    display: flex;
    gap: var(--app-shell-gap);
    justify-content: center;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    padding: var(--app-shell-pad-y) var(--app-shell-pad-x);
    box-sizing: border-box;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
}

.container {
    flex: 1;
    max-width: 800px;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    box-shadow: none;
    padding: var(--panel-pad);
    overflow-y: auto;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

/* Logo Container Styles */
.logo-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0 20px 0;
    padding: 10px 156px 10px 0;
}

.logo-img {
    max-width: 200px;
    max-height: 45px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: none;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.02);
    filter: none;
}

.logo-language-selector {
    position: absolute;
    top: 0;
    right: 0;
    transform: none;
}

.logo-language-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transform: translateY(-50%);
    z-index: 1;
}

.logo-language-icon .icon-svg {
    width: 14px;
    height: 14px;
}

.logo-language-selector select {
    width: 132px;
    min-width: 132px;
    height: 38px;
    padding: 0 34px 0 34px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.logo-language-selector select:hover,
.logo-language-selector select:focus {
    color: var(--text-primary);
    border-color: rgba(57, 255, 20, 0.24);
    background-color: rgba(255, 255, 255, 0.07);
}

.logo-language-selector:hover .logo-language-icon,
.logo-language-selector:focus-within .logo-language-icon {
    color: var(--accent);
}

.logo-language-selector select option {
    background: #1f1f1f;
    color: #f5f5f5;
}

:root[data-theme='light'] .logo-language-selector select {
    border-color: rgba(15, 23, 42, 0.08);
    background-color: rgba(255, 255, 255, 0.92);
    color: #475569;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

:root[data-theme='light'] .logo-language-icon {
    color: #94a3b8;
}

:root[data-theme='light'] .logo-language-selector select:hover,
:root[data-theme='light'] .logo-language-selector select:focus {
    border-color: rgba(13, 159, 110, 0.28);
    background-color: #ffffff;
    color: #0f172a;
}

:root[data-theme='light'] .logo-language-selector select option {
    background: #ffffff;
    color: #0f172a;
}

.admin-body {
    overflow: auto;
    text-align: left;
    background:
        radial-gradient(circle at 15% 20%, rgba(57, 255, 20, 0.14), transparent 28%),
        radial-gradient(circle at 85% 12%, rgba(0, 214, 201, 0.14), transparent 24%),
        linear-gradient(135deg, #05080d 0%, #0a1116 55%, #11181a 100%);
}

.admin-bg-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(14px);
    opacity: 0.45;
    pointer-events: none;
    z-index: 0;
}

.admin-bg-orb-a {
    top: 80px;
    left: 6%;
    width: 280px;
    height: 280px;
    background: rgba(57, 255, 20, 0.14);
}

.admin-bg-orb-b {
    right: 6%;
    bottom: 60px;
    width: 360px;
    height: 360px;
    background: rgba(0, 214, 201, 0.12);
}

.admin-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 36px;
}

.admin-login-view {
    min-height: calc(100vh - 56px);
    display: grid;
    place-items: center;
}

.admin-login-card,
.auth-modal-card {
    width: min(560px, 100%);
    padding: 36px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(8, 16, 22, 0.92), rgba(14, 24, 28, 0.9));
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
}

.admin-kicker {
    display: inline-flex;
    margin-bottom: 10px;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #87ff6b;
}

.admin-header .admin-kicker {
    display: none;
}

.admin-login-copy h1 {
    margin: 0 0 10px;
    font-size: clamp(34px, 6vw, 48px);
    line-height: 1.02;
}

.auth-modal-title {
    margin: 0;
    font-size: clamp(28px, 4vw, 34px);
    line-height: 1.08;
}

.admin-login-copy p {
    margin: 0;
    color: #a9b7bb;
    font-size: 14px;
}

.admin-login-form {
    margin-top: 28px;
    display: grid;
    gap: 16px;
}

.admin-field,
.admin-checkbox-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-field span,
.admin-checkbox-field span {
    font-size: 12px;
    color: #b5c3c7;
}

.admin-field-hint {
    font-size: 11px;
    color: #93a9af;
}

.admin-field input,
.admin-field select,
.admin-field textarea,
.email-auth-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #f1f6f7;
    font: inherit;
    outline: none;
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus,
.email-auth-input:focus {
    border-color: rgba(57, 255, 20, 0.6);
    box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.12);
}

.admin-submit-btn {
    margin-top: 6px;
    min-height: 46px;
}

.admin-login-foot {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    font-size: 13px;
}

.admin-inline-note {
    color: #8da2a7;
}

.admin-ghost-link {
    color: #9ff88b;
    text-decoration: none;
}

.admin-console-view {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 18px;
    min-height: calc(100vh - 56px);
    align-items: start;
}

.admin-console-view[hidden],
.admin-login-view[hidden],
.admin-flash[hidden] {
    display: none !important;
}

.admin-sidebar,
.admin-surface,
.admin-header {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 17, 22, 0.86);
    backdrop-filter: blur(10px);
}

.admin-sidebar {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border-radius: 24px;
    max-height: calc(100vh - 48px);
}

.admin-brand strong {
    display: block;
    font-size: 20px;
    color: #f3f7f8;
    letter-spacing: -0.02em;
}

.admin-operator-card {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(57, 255, 20, 0.11), rgba(0, 214, 201, 0.08));
}

.admin-avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background-color: #ffffff;
    background-image: url('/assets/avatar.png');
    background-repeat: no-repeat;
    background-position: center 28%;
    background-size: 132%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: transparent;
    font-size: 0;
    overflow: hidden;
}

.admin-operator-name {
    color: #f3f7f8;
    font-weight: 600;
    font-size: 13px;
}

.admin-operator-meta {
    margin-top: 4px;
    color: #90a7ad;
    font-size: 12px;
}

.admin-nav {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.admin-nav-btn,
.admin-side-action,
.admin-table-action {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #e7eff1;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.admin-nav-btn {
    text-align: left;
    padding: 11px 13px;
    border-radius: 14px;
    font: inherit;
    font-size: 13px;
}

.admin-nav-btn:hover,
.admin-side-action:hover,
.admin-table-action:hover {
    transform: translateY(-1px);
    border-color: rgba(57, 255, 20, 0.35);
}

.admin-nav-btn.is-active {
    background: linear-gradient(135deg, rgba(57, 255, 20, 0.18), rgba(0, 214, 201, 0.12));
    border-color: rgba(57, 255, 20, 0.4);
}

.admin-sidebar-bottom {
    display: grid;
    gap: 8px;
}

.admin-side-action {
    min-height: 36px;
    border-radius: 12px;
    font: inherit;
    font-size: 13px;
}

.admin-main {
    display: grid;
    gap: 16px;
    align-content: start;
    align-items: start;
    grid-auto-rows: max-content;
    min-width: 0;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 2px 0;
    border-radius: 16px;
    min-height: 52px;
    background: transparent;
    border: 0;
    backdrop-filter: none;
    box-shadow: none;
}

.admin-header h2 {
    margin: 0;
    font-size: 14px;
    color: #f3f7f8;
    line-height: 1.1;
}

.admin-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.admin-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(57, 255, 20, 0.12);
    color: #bafaa8;
    font-size: 10px;
    line-height: 1;
}

.admin-status-pill.muted {
    background: rgba(255, 255, 255, 0.05);
    color: #a8b5b9;
}

.admin-flash {
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 12px;
}

.admin-flash.is-success {
    background: rgba(34, 197, 94, 0.14);
    color: #a6f2be;
}

.admin-flash.is-error {
    background: rgba(239, 68, 68, 0.14);
    color: #ffb4b4;
}

.admin-flash.is-info {
    background: rgba(0, 214, 201, 0.14);
    color: #a7f0ea;
}

.admin-panel {
    display: none;
}

.admin-panel.is-active {
    display: grid;
    gap: 14px;
}

.admin-stats-grid,
.admin-dashboard-grid,
.admin-editor-grid {
    display: grid;
    gap: 12px;
}

.admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-dashboard-grid,
.admin-editor-grid {
    grid-template-columns: 1fr;
}

.admin-panel[data-panel-view='announcements'] .admin-surface:first-child {
    order: 2;
}

.admin-panel[data-panel-view='announcements'] .admin-surface:last-child {
    order: 1;
}

.admin-surface {
    padding: 16px 18px;
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.admin-stat-card {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) auto;
    align-items: center;
    column-gap: 14px;
    row-gap: 6px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(11, 21, 26, 0.94), rgba(8, 16, 20, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid rgba(57, 255, 20, 0.5);
}

.admin-stat-label,
.admin-stat-subtext,
.admin-section-meta,
.admin-list-item span,
.admin-announcement-meta {
    color: #90a7ad;
}

.admin-stat-label {
    display: block;
    font-size: 11px;
    margin: 0;
}

.admin-stat-value {
    display: block;
    margin: 0;
    font-size: 22px;
    color: #f5f9fa;
    text-align: right;
    grid-column: 2;
    grid-row: 1 / span 2;
}

.admin-stat-subtext {
    display: block;
    margin: 0;
    font-size: 11px;
}

.admin-section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.admin-section-head h3 {
    margin: 0;
    font-size: 16px;
    color: #f1f6f7;
}

.admin-section-meta {
    display: inline-block;
    margin-top: 4px;
    color: #93a9af;
    font-size: 11px;
}

.admin-list-head {
    align-items: stretch;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-list-copy {
    display: grid;
    align-content: start;
    gap: 2px;
    min-width: 0;
}

.admin-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    width: min(420px, 100%);
    margin-left: auto;
    align-items: center;
}

.admin-filter-bar {
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.admin-filter-bar-single {
    grid-template-columns: minmax(0, 1fr);
}

.admin-toolbar-field {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
}

.admin-toolbar-field span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.admin-toolbar-field-wide {
    grid-column: auto;
}

.admin-toolbar-input {
    width: 100%;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #f1f6f7;
    font: inherit;
    font-size: 12px;
    line-height: 1.3;
    outline: none;
}

.admin-toolbar-field select.admin-toolbar-input {
    width: 104px;
    min-width: 104px;
    padding-right: 28px;
}

.admin-toolbar-input:focus {
    border-color: rgba(57, 255, 20, 0.6);
    box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.12);
}

.admin-list-stack,
.admin-card-list {
    display: grid;
    gap: 8px;
}

.admin-list-item,
.admin-announcement-card {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid rgba(0, 214, 201, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.admin-list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
}

.admin-list-item strong,
.admin-announcement-card h4 {
    display: block;
    margin-bottom: 2px;
    color: #f0f6f7;
    font-size: 13px;
}

.admin-list-meta,
.admin-announcement-actions,
.admin-announcement-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    background: rgba(4, 10, 14, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.admin-table th,
.admin-table td {
    padding: 10px 9px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #dbe4e7;
    font-size: 12px;
    vertical-align: top;
    line-height: 1.45;
}

.admin-table th {
    text-align: left;
    color: #93a9af;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.03);
    position: sticky;
    top: 0;
    z-index: 1;
    letter-spacing: 0.01em;
}

.admin-table td strong {
    display: block;
    margin-bottom: 2px;
    color: #f0f6f7;
    font-size: 12px;
}

.admin-table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.admin-table tbody tr:nth-child(2n) {
    background: rgba(255, 255, 255, 0.012);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.028);
}

.admin-table tbody tr.is-active {
    background: rgba(57, 255, 20, 0.08);
    box-shadow: inset 2px 0 0 rgba(57, 255, 20, 0.42);
}

.admin-log-detail {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
}

.admin-log-detail-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.admin-log-detail-head h4 {
    margin: 0;
    color: #f0f6f7;
    font-size: 14px;
}

.admin-log-detail-grid {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 10px;
}

.admin-log-detail-card {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.admin-log-detail-card-wide {
    grid-column: 1 / -1;
}

.admin-log-detail-label {
    font-size: 11px;
    color: #93a9af;
}

.admin-log-detail-pre {
    min-height: 110px;
    max-height: 300px;
    overflow: auto;
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(4, 10, 14, 0.34);
    color: #dbe4e7;
    font: 11px/1.5 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-log-modal[hidden] {
    display: none !important;
}

.admin-log-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 28px;
}

.admin-log-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 10, 14, 0.68);
    backdrop-filter: blur(8px);
}

.admin-log-modal-card {
    position: relative;
    z-index: 1;
    width: min(1100px, calc(100vw - 40px));
    max-height: calc(100vh - 56px);
    overflow: auto;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(8, 16, 22, 0.96), rgba(14, 24, 28, 0.94));
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.admin-log-modal-close {
    flex: 0 0 auto;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.admin-user-manage-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 4px;
}

.admin-user-manage-meta span {
    color: #93a9af;
    font-size: 11px;
}

.admin-tag {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(57, 255, 20, 0.12);
    color: #b7f8a7;
    font-size: 11px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.admin-user-manage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-redeem-setup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
}

.admin-batch-generator {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-batch-generator .admin-section-head {
    margin-bottom: 8px;
}

.admin-panel[data-panel-view='redeem'] .admin-surface {
    padding-top: 14px;
    padding-bottom: 14px;
}

.admin-panel[data-panel-view='redeem'] .admin-section-head {
    margin-bottom: 10px;
}

.admin-panel[data-panel-view='redeem'] .admin-form-actions {
    margin-top: 2px;
}

.admin-redeem-batch-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
}

.admin-field-wide,
.admin-form-actions {
    grid-column: 1 / -1;
}

.admin-form-actions {
    display: flex;
    gap: 8px;
}

.admin-checkbox-field {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 38px;
}

.admin-checkbox-field input {
    width: 18px;
    height: 18px;
}

.admin-announcement-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-announcement-card p {
    margin: 0 0 10px;
    color: #c9d7da;
    font-size: 12px;
    line-height: 1.5;
}

.admin-announcement-card {
    display: grid;
    gap: 8px;
}

.admin-table-action {
    min-height: 28px;
    padding: 0 9px;
    border-radius: 10px;
    font: inherit;
    font-size: 12px;
}

.admin-empty,
.admin-empty-row {
    color: #7f9499;
    text-align: center;
    padding: 14px;
    font-size: 12px;
}

:root[data-theme='light'] .admin-body {
    background:
        radial-gradient(circle at 14% 18%, rgba(13, 159, 110, 0.14), transparent 26%),
        radial-gradient(circle at 84% 12%, rgba(59, 130, 246, 0.12), transparent 22%),
        linear-gradient(180deg, #eef3f6 0%, #f7fafc 52%, #edf2f7 100%);
}

:root[data-theme='light'] .admin-bg-orb-a {
    background: rgba(13, 159, 110, 0.14);
}

:root[data-theme='light'] .admin-bg-orb-b {
    background: rgba(59, 130, 246, 0.12);
}

:root[data-theme='light'] .admin-login-card,
:root[data-theme='light'] .admin-sidebar,
:root[data-theme='light'] .admin-surface {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px);
}

:root[data-theme='light'] .admin-login-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 250, 252, 0.92));
}

:root[data-theme='light'] .admin-brand strong,
:root[data-theme='light'] .admin-header h2,
:root[data-theme='light'] .admin-section-head h3,
:root[data-theme='light'] .admin-stat-value,
:root[data-theme='light'] .admin-log-detail-head h4,
:root[data-theme='light'] .admin-table th,
:root[data-theme='light'] .admin-table td strong,
:root[data-theme='light'] .admin-list-item strong {
    color: #0f172a;
}

:root[data-theme='light'] .admin-kicker {
    color: #0d9f6e;
}

:root[data-theme='light'] .admin-login-copy p,
:root[data-theme='light'] .admin-operator-meta,
:root[data-theme='light'] .admin-stat-label,
:root[data-theme='light'] .admin-stat-subtext,
:root[data-theme='light'] .admin-section-meta,
:root[data-theme='light'] .admin-inline-note,
:root[data-theme='light'] .admin-user-manage-meta span {
    color: #64748b;
}

:root[data-theme='light'] .admin-operator-card,
:root[data-theme='light'] .admin-nav-btn.is-active,
:root[data-theme='light'] .admin-stat-card {
    background: linear-gradient(135deg, rgba(13, 159, 110, 0.1), rgba(59, 130, 246, 0.06));
    border-color: rgba(13, 159, 110, 0.18);
}

:root[data-theme='light'] .admin-avatar {
    background: #0d9f6e;
    color: #ffffff;
}

:root[data-theme='light'] .admin-nav-btn,
:root[data-theme='light'] .admin-side-action,
:root[data-theme='light'] .admin-table-action {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.72);
    color: #334155;
}

:root[data-theme='light'] .admin-nav-btn:hover,
:root[data-theme='light'] .admin-side-action:hover,
:root[data-theme='light'] .admin-table-action:hover {
    border-color: rgba(13, 159, 110, 0.34);
    background: #ffffff;
    color: #0d9f6e;
}

:root[data-theme='light'] .admin-status-pill {
    background: rgba(13, 159, 110, 0.12);
    color: #0f766e;
}

:root[data-theme='light'] .admin-status-pill.muted {
    background: rgba(148, 163, 184, 0.14);
    color: #475569;
}

:root[data-theme='light'] .admin-list-head,
:root[data-theme='light'] .admin-table-wrap,
:root[data-theme='light'] .admin-log-detail,
:root[data-theme='light'] .admin-filter-bar {
    border-color: rgba(148, 163, 184, 0.2);
}

:root[data-theme='light'] .admin-table-wrap,
:root[data-theme='light'] .admin-log-detail,
:root[data-theme='light'] .admin-filter-bar {
    background: rgba(248, 250, 252, 0.76);
}

:root[data-theme='light'] .admin-table th {
    background: rgba(15, 23, 42, 0.03);
    color: #64748b;
}

:root[data-theme='light'] .admin-table td {
    color: #334155;
    border-bottom-color: rgba(148, 163, 184, 0.18);
}

:root[data-theme='light'] .admin-table tbody tr:nth-child(2n) {
    background: rgba(15, 23, 42, 0.015);
}

:root[data-theme='light'] .admin-table tbody tr:hover {
    background: rgba(13, 159, 110, 0.05);
}

:root[data-theme='light'] .admin-table tbody tr.is-active {
    background: rgba(13, 159, 110, 0.1);
    box-shadow: inset 2px 0 0 rgba(13, 159, 110, 0.5);
}

:root[data-theme='light'] .admin-log-detail-pre {
    border-color: rgba(148, 163, 184, 0.22);
    background: #ffffff;
    color: #1e293b;
}

:root[data-theme='light'] .admin-log-modal-backdrop {
    background: rgba(15, 23, 42, 0.24);
}

:root[data-theme='light'] .admin-log-modal-card {
    border-color: rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 252, 0.96));
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.16);
}

:root[data-theme='light'] .admin-log-modal-close {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.92);
    color: #334155;
}

:root[data-theme='light'] .admin-tag {
    background: rgba(13, 159, 110, 0.12);
    color: #0f766e;
}

:root[data-theme='light'] .admin-field span,
:root[data-theme='light'] .admin-checkbox-field span,
:root[data-theme='light'] .admin-field-hint {
    color: #64748b;
}

:root[data-theme='light'] .admin-field input,
:root[data-theme='light'] .admin-field select,
:root[data-theme='light'] .admin-field textarea {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.94);
    color: #0f172a;
}

:root[data-theme='light'] .admin-field input:focus,
:root[data-theme='light'] .admin-field select:focus,
:root[data-theme='light'] .admin-field textarea:focus {
    border-color: rgba(13, 159, 110, 0.56);
    box-shadow: 0 0 0 3px rgba(13, 159, 110, 0.12);
}

:root[data-theme='light'] .admin-batch-generator {
    border-top-color: rgba(148, 163, 184, 0.2);
}

:root[data-theme='light'] .admin-toolbar-input {
    border-color: rgba(148, 163, 184, 0.24);
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
}

:root[data-theme='light'] .admin-toolbar-input:focus {
    border-color: rgba(13, 159, 110, 0.56);
    box-shadow: 0 0 0 3px rgba(13, 159, 110, 0.12);
}

:root[data-theme='light'] .admin-ghost-link {
    color: #0d9f6e;
}

:root[data-theme='light'] .admin-flash.is-success {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

:root[data-theme='light'] .admin-flash.is-error {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

:root[data-theme='light'] .admin-flash.is-info {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

.admin-theme-toggle {
    min-height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #dbe4e7;
}

:root[data-theme='light'] .admin-theme-toggle {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.8);
    color: #334155;
}

@media (max-width: 1180px) {
    .admin-console-view,
    .admin-dashboard-grid,
    .admin-editor-grid,
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        max-height: none;
    }
}

@media (max-width: 720px) {
    .admin-shell {
        padding: 18px;
    }

    .admin-login-card,
    .admin-sidebar,
    .admin-surface,
    .admin-header {
        border-radius: 20px;
    }

    .admin-login-card,
    .admin-sidebar,
    .admin-surface {
        padding: 20px;
    }

    .admin-log-detail-grid {
        grid-template-columns: 1fr;
    }

    .admin-log-modal {
        padding: 14px;
    }

    .admin-log-modal-card {
        width: min(100vw - 20px, 100%);
        max-height: calc(100vh - 28px);
        padding: 14px;
        border-radius: 18px;
    }

    .admin-header {
        padding: 8px 2px 2px;
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-user-manage-grid {
        grid-template-columns: 1fr;
    }

    .admin-redeem-setup-grid {
        grid-template-columns: 1fr;
    }

    .admin-redeem-batch-grid {
        grid-template-columns: 1fr;
    }

    .admin-stat-card,
    .admin-list-item {
        grid-template-columns: 1fr;
    }

    .admin-stat-value {
        grid-column: auto;
        grid-row: auto;
        text-align: left;
    }

    .admin-login-foot,
    .admin-list-item,
    .admin-announcement-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-toolbar {
        grid-template-columns: 1fr;
        width: 100%;
        margin-left: 0;
    }

    .admin-toolbar-field select.admin-toolbar-input {
        width: 100%;
        min-width: 0;
    }

    .admin-filter-bar-single {
        grid-template-columns: 1fr;
    }

    .admin-toolbar-field-wide {
        grid-column: auto;
    }
}

/* Light theme - invert logo color */
:root[data-theme='light'] .logo-img {
    filter: invert(1);
}

:root[data-theme='light'] .logo-img:hover {
    filter: invert(1);
}

.settings-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.settings-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.baud-rate-row {
    grid-column: 1 / -1;
}

.baud-rate-control {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    width: 100%;
}

.baud-rate-scenario {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(57, 255, 20, 0.06);
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.35;
}

/* 高级参数折叠区域样式 */
.advanced-settings-wrapper {
    grid-column: 1 / -1;
    margin-top: 4px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(57, 255, 20, 0.05), rgba(57, 255, 20, 0.015));
}

.advanced-settings-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    padding: 0;
    color: var(--text-secondary);
    background: transparent;
    border: 0;
    font: inherit;
    text-align: left;
    transition: color 0.2s;
    user-select: none;
}

.advanced-settings-toggle:hover {
    color: var(--accent);
}

.advanced-settings-toggle-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.advanced-settings-toggle .toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--accent-subtle);
    color: var(--accent);
}

.advanced-settings-toggle.expanded .toggle-icon {
    transform: rotate(90deg);
}

.advanced-settings-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.toggle-text {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-primary);
}

.advanced-settings-summary {
    font-size: 11px;
    color: var(--text-muted);
    white-space: normal;
}

.advanced-settings-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.advanced-settings-content {
    display: none;
    animation: slideDown 0.3s ease;
    margin-top: 14px;
}

.advanced-settings-content.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.advanced-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.advanced-setting-card {
    gap: 8px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.08);
}

label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
}

select, input[type="text"], input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}

select:hover, input[type="text"]:hover, input[type="password"]:hover {
    border-color: var(--accent);
}

select:focus, input[type="text"]:focus, input[type="password"]:focus {
    border-color: var(--border-focus);
    box-shadow: none;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23737373' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

button {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    font-weight: 600;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
    justify-content: center;
    gap: 6px;
    position: relative;
    z-index: 100 !important;
    pointer-events: auto !important;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: none;
}

:root[data-theme='light'] .btn-primary {
    color: #ffffff;
    text-shadow: none;
    box-shadow: none;
}

:root[data-theme='light'] .btn-primary:hover {
    box-shadow: none;
}

/* Light Theme Overrides for AI Components */
:root[data-theme='light'] .ai-metric-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
}

:root[data-theme='light'] .ai-metric-card:hover {
    box-shadow: none;
}

:root[data-theme='light'] .ai-metric-card::before {
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

:root[data-theme='light'] .ai-info-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 100%);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

:root[data-theme='light'] .ai-health-table-wrapper {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 100%);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

:root[data-theme='light'] .ai-health-table th,
:root[data-theme='light'] .ai-health-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

:root[data-theme='light'] .ai-health-table thead th {
    background: rgba(0, 0, 0, 0.02);
}

:root[data-theme='light'] .ai-timeline-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 252, 0.8) 100%);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

:root[data-theme='light'] .ai-timeline::before {
    background: linear-gradient(180deg, var(--accent) 0%, rgba(13, 159, 110, 0.2) 100%);
}

:root[data-theme='light'] .ai-timeline-events {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

:root[data-theme='light'] .ai-conclusion-box {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

:root[data-theme='light'] .ai-conclusion-warning {
    background: rgba(234, 179, 8, 0.08);
    border-color: rgba(234, 179, 8, 0.3);
}

:root[data-theme='light'] .ai-conclusion-error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
}

:root[data-theme='light'] .ai-conclusion-success {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.3);
}

:root[data-theme='light'] .ai-raw-logs {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

:root[data-theme='light'] .hardware-icon {
    background: rgba(13, 159, 110, 0.1);
    border: 1px solid rgba(13, 159, 110, 0.2);
}

:root[data-theme='light'] .ai-section-title {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

:root[data-theme='light'] .ai-card-header {
    color: var(--text-secondary);
}

:root[data-theme='light'] .ai-card-header svg {
    color: var(--accent);
}

:root[data-theme='light'] .ai-card-desc {
    color: var(--text-muted);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

:root[data-theme='light'] .ai-overview-grid {
    gap: 20px;
}

:root[data-theme='light'] .ai-info-cards-grid {
    gap: 20px;
}

:root[data-theme='light'] .ai-split-view {
    gap: 20px;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .result-line {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

:root[data-theme='light'] .ai-health-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.015);
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .result-detail {
    background: rgba(13, 159, 110, 0.05);
    border-left: 3px solid var(--accent);
}

:root[data-theme='light'] .ai-status-success {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.4);
}

:root[data-theme='light'] .ai-status-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.4);
}

:root[data-theme='light'] .ai-status-error {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.4);
}

:root[data-theme='light'] .ai-status-neutral {
    background: rgba(156, 163, 175, 0.12);
    color: #4b5563;
    border-color: rgba(156, 163, 175, 0.4);
}

:root[data-theme='light'] .ai-timeline-dot {
    border: 3px solid var(--bg-secondary);
    box-shadow: none;
}

:root[data-theme='light'] .ai-badge-success {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

:root[data-theme='light'] .ai-badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

:root[data-theme='light'] .ai-badge-error {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

:root[data-theme='light'] .ai-conclusion-warning .ai-conclusion-title {
    color: #b45309;
}

:root[data-theme='light'] .ai-conclusion-error .ai-conclusion-title {
    color: #b91c1c;
}

:root[data-theme='light'] .ai-card-value.status-success { 
    color: #15803d;
    text-shadow: none;
}

:root[data-theme='light'] .ai-card-value.status-blue { 
    color: #1d4ed8;
    text-shadow: none;
}

:root[data-theme='light'] .ai-card-value.status-warning { 
    color: #b45309;
    text-shadow: none;
}

:root[data-theme='light'] .ai-card-value.status-error { 
    color: #b91c1c;
    text-shadow: none;
}

:root[data-theme='light'] .ai-timeline-time {
    color: #0d9f6e;
}

:root[data-theme='light'] .ai-card-value {
    text-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .metric-voltage {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .metric-frequency {
    background: rgba(168, 85, 247, 0.1);
    color: #7c3aed;
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .metric-capacity {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .metric-temperature {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .metric-current {
    background: rgba(6, 182, 212, 0.1);
    color: #0e7490;
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .metric-percentage {
    background: rgba(234, 179, 8, 0.1);
    color: #a16207;
    border-color: rgba(234, 179, 8, 0.3);
    box-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .metric-version {
    background: rgba(236, 72, 153, 0.1);
    color: #be185d;
    border-color: rgba(236, 72, 153, 0.3);
    box-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .metric-resistance {
    background: rgba(156, 163, 175, 0.1);
    color: #4b5563;
    border-color: rgba(156, 163, 175, 0.3);
    box-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .metric-time {
    background: rgba(168, 162, 158, 0.1);
    color: #78716c;
    border-color: rgba(168, 162, 158, 0.3);
    box-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .metric-hex {
    background: rgba(6, 182, 212, 0.1);
    color: #0e7490;
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: none;
}

:root[data-theme='light'] .ai-health-table td:nth-child(2) .result-metric {
    box-shadow: none;
}

:root[data-theme='light'] .ai-info-card-title {
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

:root[data-theme='light'] .ai-info-card-title svg {
    color: var(--accent);
}

:root[data-theme='light'] .ai-info-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

:root[data-theme='light'] .ai-info-label {
    color: var(--text-muted);
}

:root[data-theme='light'] .ai-info-value {
    color: var(--text-primary);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.button-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    align-items: stretch;
    margin-bottom: 16px;
}

.button-group button {
    width: 100%;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 16px;
}

.action-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.action-btn-icon .icon-svg {
    width: 16px;
    height: 16px;
}

.action-btn-label {
    line-height: 1;
    white-space: nowrap;
}

.output-container {
    margin-bottom: 16px;
    position: relative;
    flex: 1;
    display: flex;
    min-height: var(--output-min-height);
}

.analysis-import-panel {
    position: relative;
    margin-bottom: 16px;
    padding: 12px;
    padding-right: 108px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(57, 255, 20, 0.05), rgba(57, 255, 20, 0.015));
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.analysis-import-panel.is-collapsed {
    padding: 0;
    margin-bottom: 0;
    min-height: 0;
    display: block;
    width: var(--ai-header-stack-width);
    min-width: var(--ai-header-stack-width);
    max-width: var(--ai-header-stack-width);
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.analysis-import-panel.is-drag-over {
    border-color: rgba(57, 255, 20, 0.5);
    background: linear-gradient(180deg, rgba(57, 255, 20, 0.12), rgba(57, 255, 20, 0.04));
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.18);
}

.analysis-import-panel.is-drag-over .analysis-import-title,
.analysis-import-panel.is-drag-over .analysis-import-meta,
.analysis-import-panel.is-drag-over .analysis-drop-guide-text {
    color: var(--accent);
}

.analysis-import-panel.is-drag-over .analysis-drop-overlay {
    display: flex;
}

.analysis-import-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 8px;
}

.analysis-import-copy {
    min-width: 0;
    text-align: left;
}

.analysis-import-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.analysis-import-meta {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.analysis-import-actions {
    display: block;
    width: 100%;
}

.analysis-panel-toggle-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    min-width: 78px;
    z-index: 1;
    gap: 6px;
    padding: 0 12px;
}

.analysis-panel-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.analysis-panel-toggle-icon .icon-svg {
    width: 14px;
    height: 14px;
}

.analysis-panel-toggle-label {
    line-height: 1;
}

.analysis-import-panel.is-collapsed .analysis-import-head {
    display: block;
    width: 100%;
    margin-bottom: 0;
}

.analysis-import-panel.is-collapsed .analysis-import-copy {
    display: none;
}

.analysis-import-panel.is-collapsed .analysis-import-title {
    display: none;
}

.analysis-import-panel.is-collapsed .analysis-panel-toggle-btn {
    position: static;
    display: flex;
    width: var(--ai-header-stack-width);
    min-width: var(--ai-header-stack-width);
    max-width: var(--ai-header-stack-width);
    flex: 0 0 var(--ai-header-stack-width);
    min-height: 44px;
    box-sizing: border-box;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(57, 255, 20, 0.12), rgba(57, 255, 20, 0.05));
    border-color: rgba(57, 255, 20, 0.22);
    box-shadow: none;
    transform: none;
}

@media (min-width: 1025px) {
    .analysis-import-panel.is-collapsed {
        position: absolute;
        top: 64px;
        right: var(--panel-pad);
        z-index: 4;
    }
}

.analysis-import-panel.is-collapsed .analysis-import-meta,
.analysis-import-panel.is-collapsed .analysis-mode-field,
.analysis-import-panel.is-collapsed .analysis-drop-zone {
    display: none;
}

.analysis-import-panel.is-collapsed .analysis-import-actions {
    display: block;
    width: var(--ai-header-stack-width);
    min-width: var(--ai-header-stack-width);
}

.analysis-import-panel.is-collapsed #toggleAnalysisPanelBtn {
    display: flex;
    width: var(--ai-header-stack-width) !important;
    min-width: var(--ai-header-stack-width) !important;
    max-width: var(--ai-header-stack-width) !important;
    margin-left: auto;
    margin-right: auto;
}

.analysis-mode-field {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 160px;
    text-align: left;
}

.analysis-mode-field span {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.analysis-mode-select,
.analysis-action-btn {
    min-height: 36px;
    border-radius: 10px;
}

.analysis-mode-select {
    width: 100%;
    min-width: 180px;
    padding: 7px 34px 7px 12px;
    background-color: var(--bg-input);
    border-color: rgba(57, 255, 20, 0.14);
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.04);
}

.analysis-mode-select:hover,
.analysis-mode-select:focus {
    border-color: var(--accent);
}

.analysis-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    padding: 0 12px;
    white-space: nowrap;
    background: linear-gradient(180deg, rgba(57, 255, 20, 0.08), rgba(57, 255, 20, 0.03));
    border: 1px solid rgba(57, 255, 20, 0.14);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.04);
}

.analysis-toggle-btn {
    min-width: 78px;
}

.analysis-action-btn:hover {
    background: linear-gradient(180deg, rgba(57, 255, 20, 0.14), rgba(57, 255, 20, 0.06));
    border-color: rgba(57, 255, 20, 0.3);
    color: var(--accent);
}

.analysis-import-textarea {
    width: 100%;
    min-height: 46px;
    height: 46px;
    max-height: 46px;
    resize: none;
    padding: 12px 14px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.6;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    outline: none;
    overflow-y: hidden;
    transition: height 0.2s ease, min-height 0.2s ease, max-height 0.2s ease, border-color 0.2s ease;
}

.analysis-import-textarea.is-expanded {
    min-height: var(--analysis-input-min-height);
    height: clamp(var(--analysis-input-min-height), 30vh, 320px);
    max-height: 50vh;
    resize: vertical;
    overflow-y: auto;
}

.analysis-import-textarea:focus {
    border-color: var(--border-focus);
}

.analysis-drop-zone {
    position: relative;
    display: grid;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px dashed rgba(57, 255, 20, 0.24);
    background:
        radial-gradient(circle at top right, rgba(57, 255, 20, 0.08), transparent 38%),
        linear-gradient(180deg, rgba(57, 255, 20, 0.05), rgba(57, 255, 20, 0.015));
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.analysis-drop-zone-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
}

.analysis-drop-zone.is-drag-over {
    border-color: rgba(57, 255, 20, 0.55);
    background:
        radial-gradient(circle at top right, rgba(57, 255, 20, 0.14), transparent 42%),
        linear-gradient(180deg, rgba(57, 255, 20, 0.12), rgba(57, 255, 20, 0.05));
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.22), 0 0 0 3px rgba(57, 255, 20, 0.08);
    transform: translateY(-1px);
}

.analysis-drop-zone-head {
    display: grid;
    gap: 4px;
    text-align: left;
}

.analysis-drop-zone-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.analysis-drop-zone-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(57, 255, 20, 0.12);
    border: 1px solid rgba(57, 255, 20, 0.2);
    color: var(--accent);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.analysis-drop-zone-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-primary);
}

.analysis-drop-zone-meta {
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.analysis-drop-guide {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px dashed rgba(57, 255, 20, 0.18);
    background: rgba(57, 255, 20, 0.04);
    text-align: left;
}

.analysis-drop-guide-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(57, 255, 20, 0.1);
    color: var(--accent);
}

.analysis-drop-guide-icon .icon-svg {
    width: 12px;
    height: 12px;
}

.analysis-drop-guide-text {
    font-size: 10px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.analysis-drop-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(8, 12, 10, 0.84), rgba(10, 16, 12, 0.9)),
        rgba(57, 255, 20, 0.08);
    pointer-events: none;
    z-index: 2;
}

.analysis-drop-overlay > div {
    text-align: center;
}

.analysis-drop-overlay-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.01em;
}

.analysis-drop-overlay-meta {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(245, 245, 245, 0.8);
    line-height: 1.6;
}

.analysis-drop-zone.is-drag-over .analysis-drop-zone-title,
.analysis-drop-zone.is-drag-over .analysis-drop-zone-meta,
.analysis-drop-zone.is-drag-over .analysis-drop-guide-text {
    color: var(--accent);
}

#output {
    width: 100%;
    height: 100%;
    min-height: var(--output-min-height);
    padding: 14px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

#output:focus {
    border-color: var(--border-focus);
    box-shadow: none;
}

.input-container {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--bg-tertiary);
    padding: 14px;
    border-radius: var(--radius);
}

#input {
    flex: 1;
    height: 40px;
    padding: 8px 12px;
}

#sendButton {
    height: 40px;
    min-width: 70px;
}

.output-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.output-toolbar {
    display: none;
}

.output-toggle-btn {
    display: none;
    min-height: 32px;
    padding: 0 12px;
    font-size: 11px;
    white-space: nowrap;
}

#timestampCheckbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-container label {
    text-transform: none;
    letter-spacing: normal;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    margin: 0;
}

.advanced-setting-toggle-card {
    justify-content: space-between;
    cursor: pointer;
}

.advanced-setting-toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
}

.advanced-setting-toggle-copy {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 12px;
}

.status-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.connected {
    background: var(--success);
    box-shadow: none;
}

.status-dot.disconnected {
    background: var(--error);
}

#statusText {
    color: var(--text-secondary);
}

.language-selector {
    flex: 0 0 auto;
}

.language-selector:not(.logo-language-selector) select {
    width: auto;
    min-width: 90px;
    padding: 6px 28px 6px 10px;
    font-size: 12px;
}

.auth-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    min-width: min(336px, 100%);
    max-width: 100%;
    padding: 6px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.auth-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 14px;
}

.auth-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background-color: #ffffff;
    background-image: url('/assets/avatar.png');
    background-repeat: no-repeat;
    background-position: center 28%;
    background-size: 132%;
    color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.auth-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
}

.auth-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.auth-email {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.auth-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.mobile-points-badge {
    display: none;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(57, 255, 20, 0.16);
    background: rgba(57, 255, 20, 0.08);
    color: var(--accent);
    white-space: nowrap;
}

.mobile-points-value {
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.mobile-points-unit {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mobile-points-modal[hidden] {
    display: none !important;
}

.mobile-points-modal {
    position: fixed;
    inset: 0;
    z-index: 1260;
    display: none;
}

.mobile-points-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 8, 10, 0.72);
}

.mobile-points-card {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at top right, rgba(57, 255, 20, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(10, 17, 22, 0.98), rgba(13, 21, 24, 0.96));
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.mobile-points-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.mobile-points-title {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
}

.mobile-points-hint {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

.mobile-points-close-btn {
    width: 36px;
    height: 36px;
    padding: 0;
}

.mobile-points-balance {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.mobile-points-balance-value {
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
    color: var(--accent);
}

.mobile-points-balance-unit {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.mobile-points-redeem {
    display: grid;
    gap: 10px;
}

.auth-btn {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    min-width: auto;
    white-space: nowrap;
}

.auth-entry-btn {
    min-width: 108px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-color: rgba(57, 255, 20, 0.18);
    background: rgba(57, 255, 20, 0.14);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.04);
}

.auth-entry-btn:hover {
    border-color: rgba(57, 255, 20, 0.32);
    background: rgba(57, 255, 20, 0.2);
}

@media (min-width: 1025px) {
    .status-bar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: stretch;
        column-gap: 14px;
        row-gap: 8px;
        padding: 8px 10px;
        border: 1px solid rgba(255, 255, 255, 0.06);
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
    }

    .status-indicator {
        height: 56px;
        min-height: 56px;
        padding: 0 14px;
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, 0.06);
        background: rgba(255, 255, 255, 0.02);
        gap: 8px;
        white-space: nowrap;
    }

    #statusText {
        font-size: 12px;
        font-weight: 600;
    }

    .status-actions {
        width: 100%;
        display: flex;
        align-items: stretch;
        justify-content: end;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .logo-language-selector {
        right: 0;
    }

    .auth-panel {
        width: min(100%, 372px);
        min-width: 320px;
        min-height: 56px;
        height: 56px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 4px;
        padding: 4px;
        border-radius: 16px;
    }

    .auth-user {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        min-width: 0;
        padding: 0 8px;
        height: 100%;
    }

    .auth-avatar {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 13px;
    }

    .auth-meta {
        justify-content: center;
        gap: 2px;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .auth-name {
        font-size: 13px;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: keep-all;
        line-height: 1.1;
    }

    .auth-email {
        font-size: 10px;
        display: block;
        max-width: none;
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: keep-all;
        line-height: 1.2;
    }

    .auth-actions {
        gap: 4px;
        height: 100%;
        align-items: center;
    }

    .auth-btn {
        min-height: 40px;
        padding: 0 12px;
        border-radius: 10px;
        font-size: 11px;
    }

    .auth-entry-btn {
        min-width: 90px;
        gap: 6px;
    }

    .auth-menu-btn {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
}

.auth-dev-btn {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.08);
}

.auth-dev-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.auth-entry-icon,
.auth-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-entry-icon .icon-svg,
.auth-menu-btn .icon-svg {
    width: 16px;
    height: 16px;
}

.auth-menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
}

.auth-menu-btn[aria-expanded='true'] {
    background: rgba(57, 255, 20, 0.12);
    border-color: rgba(57, 255, 20, 0.18);
    color: var(--accent);
}

.auth-menu-btn[aria-expanded='true'] .icon-svg {
    transform: rotate(180deg);
}

.auth-menu-btn .icon-svg {
    transition: transform 0.2s ease;
}

.auth-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    width: min(272px, calc(100vw - 32px));
}

.auth-menu-card {
    display: grid;
    gap: 16px;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(20, 24, 28, 0.98), rgba(14, 18, 22, 0.96));
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(14px);
}

:root[data-theme='light'] .auth-panel {
    border-color: rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92));
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

:root[data-theme='light'] .mobile-points-badge {
    border-color: rgba(13, 159, 110, 0.14);
    background: rgba(13, 159, 110, 0.08);
    color: #0f9f6e;
}

:root[data-theme='light'] .mobile-points-card {
    border-color: rgba(15, 23, 42, 0.08);
    background:
        radial-gradient(circle at top right, rgba(13, 159, 110, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.96));
}

:root[data-theme='light'] .auth-avatar {
    border-color: rgba(34, 197, 94, 0.12);
}

:root[data-theme='light'] .auth-menu-btn {
    border-color: rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 252, 0.9);
    color: #64748b;
}

:root[data-theme='light'] .auth-menu-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 247, 250, 0.96));
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

:root[data-theme='light'] .auth-menu-user {
    background: rgba(248, 250, 252, 0.96);
    border-color: rgba(15, 23, 42, 0.08);
}

.auth-menu-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
}

.auth-menu-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-menu-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    background-image: url('/assets/avatar.png');
    background-repeat: no-repeat;
    background-position: center 28%;
    background-size: 132%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: transparent;
    font-size: 0;
    flex: 0 0 auto;
    overflow: hidden;
}

.auth-menu-meta {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.auth-menu-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
}

.auth-menu-email {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
    word-break: break-word;
}

.auth-menu-logout-btn {
    width: 100%;
    justify-content: center;
    min-height: 40px;
    border-radius: 14px;
    font-size: 13px;
}

.email-auth-form {
    display: grid;
    gap: 14px;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.email-auth-input {
    appearance: none;
    -webkit-appearance: none;
    flex: 1 1 180px;
    min-width: 0;
    background: rgba(255, 255, 255, 0.04) !important;
}

.email-auth-code {
    flex: 0 0 110px;
    text-align: center;
    letter-spacing: 0.24em;
}

.auth-modal[hidden] {
    display: none !important;
}

.auth-modal [hidden] {
    display: none !important;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 1250;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top, rgba(57, 255, 20, 0.08), transparent 40%),
        rgba(3, 8, 10, 0.74);
}

.auth-modal-card {
    position: relative;
    z-index: 1;
    width: min(540px, calc(100vw - 32px));
    margin: auto;
    display: grid;
    gap: 16px;
    max-height: calc(100vh - 48px);
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(57, 255, 20, 0.09), transparent 34%),
        linear-gradient(180deg, rgba(10, 17, 22, 0.97), rgba(13, 21, 24, 0.95));
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
    overflow: hidden;
}

:root[data-theme='light'] .auth-modal-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.96));
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
}

.auth-modal-kicker {
    width: fit-content;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid rgba(57, 255, 20, 0.18);
    background: rgba(57, 255, 20, 0.08);
}

.auth-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-modal-copy {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.auth-modal-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: clamp(28px, 4vw, 34px);
    line-height: 1.05;
}

.auth-modal-hint {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    max-width: 42ch;
}

.auth-modal-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    flex: 0 0 auto;
}

.auth-modal-close-btn:hover {
    border-color: rgba(57, 255, 20, 0.22);
    background: rgba(57, 255, 20, 0.08);
    color: var(--accent);
}

.auth-modal-section {
    display: grid;
    gap: 12px;
    padding: 0;
    border: 0;
    background: transparent;
}

.auth-modal-section-primary {
    gap: 14px;
}

.auth-modal-section-secondary {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-section-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    min-height: 22px;
    display: inline-flex;
    align-items: center;
}

.auth-modal-switches {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    padding: 5px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-mode-btn {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-mode-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.auth-mode-btn.is-active {
    background: linear-gradient(180deg, rgba(57, 255, 20, 0.16), rgba(57, 255, 20, 0.08));
    color: #dcffd5;
    border-color: rgba(57, 255, 20, 0.16);
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.05);
}

.auth-modal-form {
    display: grid !important;
    gap: 12px;
    width: 100%;
    padding: 0;
}

.email-auth-form {
    padding: 0;
}

.auth-field {
    display: grid;
    gap: 6px;
}

.auth-field-code {
    min-width: 0;
}

.auth-field-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.email-auth-input,
.email-auth-code {
    min-height: 50px;
    padding: 0 16px;
    border-radius: 16px;
    border: 0;
    background: rgba(6, 11, 13, 0.72);
    color: var(--text-primary);
    font-size: 14px;
    box-shadow: none;
}

.email-auth-input::placeholder,
.email-auth-code::placeholder {
    color: var(--text-muted);
}

.email-auth-input:focus,
.email-auth-code:focus {
    background: rgba(8, 14, 16, 0.82);
    box-shadow: none;
}

.auth-empty-state {
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.auth-empty-title {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
}

.auth-empty-copy {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
}

.auth-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 136px;
    align-items: end;
    gap: 10px;
}

.auth-code-btn {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    border-radius: 14px;
}

.auth-submit-btn {
    width: 100%;
    min-height: 50px;
    margin-top: 4px;
    justify-content: center;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 800;
}

.auth-google-btn {
    width: 100%;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 16px;
}

.auth-dev-modal-btn {
    width: 100%;
    justify-content: center;
}

.auth-google-mark {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 800;
    flex: 0 0 auto;
}

.auth-dev-hint {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
}

.auth-aux-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 20px;
}

.auth-text-btn {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.auth-text-btn:hover {
    color: #dcffd5;
    text-decoration: underline;
}

.auth-text-btn[hidden] {
    display: none !important;
}

:root[data-theme='light'] .auth-modal-section {
    background: transparent;
}

:root[data-theme='light'] .auth-modal-section-primary {
    background: transparent;
}

:root[data-theme='light'] .auth-modal-kicker {
    border-color: rgba(13, 159, 110, 0.18);
    background: rgba(13, 159, 110, 0.08);
    color: #0f9f6e;
}

:root[data-theme='light'] .auth-modal-close-btn {
    border-color: rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 252, 0.92);
    color: #64748b;
}

:root[data-theme='light'] .auth-modal-switches {
    background: rgba(241, 245, 249, 0.88);
    border-color: rgba(15, 23, 42, 0.08);
}

:root[data-theme='light'] .auth-modal-section-secondary {
    border-top-color: rgba(15, 23, 42, 0.08);
}

:root[data-theme='light'] .auth-mode-btn.is-active {
    color: #0f9f6e;
    background: linear-gradient(180deg, rgba(13, 159, 110, 0.16), rgba(13, 159, 110, 0.08));
    border-color: rgba(13, 159, 110, 0.18);
}

:root[data-theme='light'] .email-auth-input,
:root[data-theme='light'] .email-auth-code {
    background: rgba(255, 255, 255, 0.94);
    border: 0;
    box-shadow: none;
}

:root[data-theme='light'] .email-auth-input:focus,
:root[data-theme='light'] .email-auth-code:focus {
    background: #fff;
    box-shadow: none;
}

:root[data-theme='light'] .auth-text-btn {
    color: #0f9f6e;
}

.cloud-dashboard {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.cloud-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    text-align: left;
}

.cloud-balance-card {
    display: grid;
    gap: 12px;
    align-content: start;
    background:
        radial-gradient(circle at top left, rgba(57, 255, 20, 0.14), transparent 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
    border-color: rgba(57, 255, 20, 0.12);
}

.cloud-balance-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.cloud-balance-value-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-top: 4px;
}

.cloud-balance-value {
    margin: 0;
    font-size: clamp(30px, 3.5vw, 40px);
    line-height: 1;
    letter-spacing: -0.03em;
}

.cloud-balance-unit {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-bottom: 4px;
}

.cloud-balance-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(57, 255, 20, 0.12);
    border: 1px solid rgba(57, 255, 20, 0.18);
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.cloud-balance-toggle {
    appearance: none;
    -webkit-appearance: none;
    gap: 6px;
    cursor: pointer;
}

.cloud-balance-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
}

.cloud-balance-toggle-icon .icon-svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.cloud-balance-card.is-redeem-collapsed .cloud-balance-toggle-icon .icon-svg {
    transform: rotate(-90deg);
}

.cloud-balance-hint {
    display: none;
    font-size: 11px;
    line-height: 1.45;
}

.cloud-redeem-panel {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.16);
}

.cloud-balance-card.is-redeem-collapsed .cloud-redeem-panel {
    display: none;
}

:root[data-theme='light'] .cloud-redeem-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(245, 247, 250, 0.92));
    border-color: rgba(15, 23, 42, 0.08);
}

.cloud-redeem-field {
    display: grid;
    gap: 6px;
}

.cloud-redeem-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cloud-card-wide {
    min-width: 0;
}

.cloud-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cloud-card-label {
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.cloud-card-value {
    color: var(--text-primary);
    font-size: 26px;
    font-weight: 700;
    margin: 6px 0 4px;
}

.cloud-card-hint {
    color: var(--text-muted);
    font-size: 11px;
}

.redeem-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    margin: 0;
}

.redeem-input {
    width: 100%;
    min-width: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 7px 10px;
    font-size: 12px;
}

.redeem-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.cloud-redeem-btn {
    min-width: 96px;
    min-height: 34px;
}

.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.announcement-item {
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.announcement-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.announcement-title {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.announcement-type {
    color: var(--accent);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.announcement-meta,
.announcement-empty {
    color: var(--text-muted);
    font-size: 11px;
}

.member-panel-empty {
    color: var(--text-muted);
    font-size: 12px;
}

.member-list-item,
.announcement-detail-card {
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.member-list-item {
    cursor: pointer;
}

.member-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.member-list-title {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.member-list-meta {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 4px;
}

.member-list-summary,
.announcement-detail-content {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}

.announcement-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.announcement-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.announcement-modal-card {
    position: relative;
    z-index: 1;
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    margin: 24px auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.announcement-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.announcement-modal-title {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.announcement-modal-body {
    padding: 18px;
    overflow-y: auto;
}

.member-list-badge {
    color: var(--accent);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.member-list-badge.positive {
    color: var(--success);
}

.member-list-badge.negative {
    color: var(--error);
}

.admin-center {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    min-width: 0;
}

.admin-panel-wide {
    grid-column: span 2;
}

.admin-form {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.admin-editor {
    margin-top: 10px;
}

.admin-textarea {
    width: 100%;
    min-height: 88px;
    resize: vertical;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    box-sizing: border-box;
}

.admin-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 12px;
}

.admin-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.admin-main > .admin-panel {
    display: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    min-width: 0;
}

.admin-main > .admin-panel.is-active {
    display: grid;
    gap: 14px;
}

/* AI Panel Header */
.ai-panel-header {
    position: relative;
    text-align: left;
    margin-bottom: 20px;
    padding: 4px 148px 16px 0;
    min-height: 118px;
    border-bottom: 1px solid var(--border);
}

.ai-panel-header-actions {
    position: absolute;
    top: 2px;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 4px;
    width: var(--ai-header-stack-width);
    min-width: var(--ai-header-stack-width);
    max-width: var(--ai-header-stack-width);
    box-sizing: border-box;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
}

#historyBtn,
#themeToggleBtn,
#toggleAnalysisPanelBtn {
    box-sizing: border-box;
}

.ai-panel-header-actions:has(#historyBtn):has(#themeToggleBtn) {
    width: var(--ai-header-stack-width) !important;
    min-width: var(--ai-header-stack-width) !important;
    max-width: var(--ai-header-stack-width) !important;
}

.ai-panel-header-actions #historyBtn {
    flex: 1 1 auto;
    min-width: 0;
}

.ai-panel-header-actions #themeToggleBtn {
    flex: 0 0 34px;
}

.ai-panel-header-actions:empty {
    display: none;
}

.ai-panel-header-actions .ai-header-tool {
    min-height: 34px;
    color: var(--text-secondary);
    background: transparent;
    border-radius: 999px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ai-panel-header-actions .ai-header-tool:hover {
    background: rgba(57, 255, 20, 0.1);
    color: var(--accent);
}

.ai-panel-header-actions .ai-header-tool-history {
    padding: 0 12px;
    gap: 7px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.ai-panel-header-actions .ai-header-tool-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 10px;
}

.ai-panel-header-actions .ai-header-tool .icon-svg {
    width: 16px;
    height: 16px;
}

:root[data-theme='light'] .ai-panel-header-actions {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

:root[data-theme='light'] .ai-panel-header-actions .ai-header-tool {
    color: #475569;
}

:root[data-theme='light'] .ai-panel-header-actions .ai-header-tool:hover {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.ai-title-gradient {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.ai-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.2em;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.ai-badge-skyeye {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
}

/* AI Panel Styles */
.ai-panel {
    --ai-header-stack-width: 136px;
    flex: 1;
    min-width: min(420px, 100%);
    max-width: 55%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    box-shadow: none;
    padding: var(--panel-pad);
    overflow-y: hidden; /* to keep results scrollable inside */
    height: 100%;
}

.ai-panel h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--accent);
    letter-spacing: -0.025em;
    text-align: left;
}

.ai-toolbar {
    display: flex;
    justify-content: stretch;
    align-items: stretch;
    width: 100%;
    margin-bottom: 16px;
}

.ai-toolbar.is-collapsed {
    display: none;
}

.ai-toolbar-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ai-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: stretch;
    gap: 10px;
    width: 100%;
}


.ai-full-row {
    width: 100%;
}

.ai-results {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-right: 4px;
}

/* Modern Section Titles */
.ai-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-section-title svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

/* Modern Card Grid - Inspired by Reference Design */
.ai-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
    align-items: stretch;
}

.ai-metric-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(40, 40, 60, 0.8) 100%);
    padding: 20px 22px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-content: flex-start;
    min-height: 220px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none; 
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    text-align: left;
}

.ai-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.ai-metric-card:hover {
    transform: translateY(-3px);
    box-shadow: none; 
                0 0 20px rgba(57, 255, 20, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: rgba(57, 255, 20, 0.2);
}

.ai-metric-card:hover::before {
    opacity: 1;
}

.ai-card-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: left;
}

.ai-card-header svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    color: var(--accent);
    opacity: 0.9;
}

.ai-header-title {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
}

.ai-card-value {
    flex: 1;
    width: 100%;
    font-size: clamp(28px, 2vw, 42px);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -0.02em;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.ai-card-value.status-success { 
    color: #22c55e;
    text-shadow: none;
}
.ai-card-value.status-blue { 
    color: #3b82f6;
    text-shadow: none;
}
.ai-card-value.status-warning { 
    color: #f59e0b;
    text-shadow: none;
}
.ai-card-value.status-error { 
    color: #ef4444;
    text-shadow: none;
}
.ai-card-value.status-neutral { color: var(--text-primary); }

.ai-card-desc {
    width: 100%;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
    word-break: break-word;
}

/* Device Info & Boot Reason Cards */
.ai-info-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.ai-info-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(35, 35, 50, 0.9) 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

.ai-info-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-info-card-title svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.ai-info-card-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-info-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ai-info-item:last-child {
    border-bottom: none;
}

.ai-info-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 80px;
}

.ai-info-value {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    flex: 1;
    margin-left: 12px;
    line-height: 1.5;
}

/* Modern Timeline */
.ai-timeline {
    position: relative;
    padding-left: 24px;
    margin: 0 0 24px 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ai-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg, var(--accent) 0%, rgba(57, 255, 20, 0.2) 100%);
    border-radius: 2px;
}

.ai-timeline-item {
    position: relative;
    background: linear-gradient(135deg, rgba(40, 40, 55, 0.6) 0%, rgba(30, 30, 45, 0.4) 100%);
    padding: 16px 18px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s;
}

.ai-timeline-item:hover {
    border-color: rgba(57, 255, 20, 0.2);
    box-shadow: none;
}

.ai-timeline-dot {
    position: absolute;
    left: -22px;
    top: 20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg-secondary);
    box-shadow: none;
    z-index: 2;
}

.ai-timeline-time {
    font-size: 12px;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.ai-timeline-phase {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.ai-timeline-events {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Modern Hardware Table */
.ai-health-table-wrapper {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(35, 35, 50, 0.9) 100%);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: none;
}

.ai-health-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    table-layout: fixed;
}

.ai-health-table th, .ai-health-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    direction: ltr !important;
}

.ai-health-table tr:last-child td {
    border-bottom: none;
}

.ai-health-table thead th {
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 18px;
}

.ai-health-table td {
    color: var(--text-primary);
    font-weight: 500;
}

.ai-health-table td strong {
    color: var(--text-primary);
    font-weight: 600;
}

.ai-health-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Modern Status Badges - Pill Style */
.ai-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    min-width: 96px;
    white-space: nowrap;
    word-break: keep-all;
    letter-spacing: 0.02em;
    border: 1px solid;
}

.ai-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.ai-detail-card {
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(40, 40, 55, 0.6) 0%, rgba(30, 30, 45, 0.4) 100%);
    text-align: left;
}

.ai-android-breakdown-card {
    border-color: rgba(57, 255, 20, 0.14);
    background: linear-gradient(135deg, rgba(32, 42, 38, 0.72) 0%, rgba(24, 28, 34, 0.58) 100%);
}

:root[data-theme='light'] .ai-detail-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 252, 0.96) 100%);
    border-color: rgba(15, 23, 42, 0.08);
}

:root[data-theme='light'] .ai-android-breakdown-card {
    background: linear-gradient(135deg, rgba(240, 253, 244, 0.96) 0%, rgba(248, 250, 252, 0.96) 100%);
    border-color: rgba(34, 197, 94, 0.16);
}

.ai-detail-line {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.ai-log-excerpt {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, "Courier New", monospace;
}

:root[data-theme='light'] .ai-log-excerpt {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.08);
    color: var(--text-primary);
}

.ai-detail-label {
    display: inline-block;
    margin-right: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.ai-priority-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(57, 255, 20, 0.12);
    color: var(--accent);
    font-size: 11px;
    white-space: nowrap;
}

.ai-step-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.ai-step-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-step-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    flex: 0 0 auto;
}

.ai-header-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.ai-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-meta-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
}

.ai-meta-tag-info {
    border-color: rgba(56, 189, 248, 0.28);
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
}

.ai-meta-tag-success {
    border-color: rgba(34, 197, 94, 0.28);
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.ai-meta-tag-warning {
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.ai-meta-tag-neutral {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(148, 163, 184, 0.08);
    color: #cbd5e1;
}

.ai-status-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.ai-status-success {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: none;
}

.ai-status-badge.status-success {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: none;
}

.ai-status-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: none;
}

.ai-status-badge.status-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: none;
}

.ai-status-error {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: none;
}

.ai-status-badge.status-error {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: none;
}

.ai-status-neutral {
    background: rgba(115, 115, 115, 0.12);
    color: var(--text-muted);
    border-color: rgba(115, 115, 115, 0.3);
}

.ai-status-badge.status-neutral,
.ai-status-badge.status-blue {
    background: rgba(115, 115, 115, 0.12);
    color: var(--text-muted);
    border-color: rgba(115, 115, 115, 0.3);
}

/* Raw Logs Section */
.ai-raw-logs {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    min-height: 300px;
    max-height: 420px;
    overflow-y: auto;
}

.ai-split-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 24px;
    align-items: stretch;
}

.ai-split-column {
    flex: none;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ai-split-column .ai-health-table-wrapper {
    flex: none;
    max-height: none;
    overflow: visible;
    margin-bottom: 0;
}

.ai-split-column .ai-raw-logs {
    flex: none;
    height: auto;
    overflow-y: auto;
}

/* Hardware Table Column Widths */
.ai-health-table th:nth-child(1),
.ai-health-table td:nth-child(1) {
    width: 22%;
    min-width: 140px;
}

.ai-health-table th:nth-child(2),
.ai-health-table td:nth-child(2) {
    width: 63%;
    min-width: 200px;
}

.ai-health-table th:nth-child(3),
.ai-health-table td:nth-child(3) {
    width: 18%;
    min-width: 120px;
    text-align: center;
}

/* Hardware Item with Icon */
.hardware-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hardware-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(57, 255, 20, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(57, 255, 20, 0.2);
    color: var(--accent);
    flex-shrink: 0;
}

.hardware-icon svg {
    width: 16px;
    height: 16px;
}

/* Enhanced Result Cell Styling */
.ai-health-table td:nth-child(2) {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-primary);
}

.ai-health-table td:nth-child(2) .result-detail {
    display: block;
    margin-top: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border-left: 3px solid var(--accent);
    font-size: 11px;
    color: var(--text-secondary);
}

.ai-health-table td:nth-child(2) .result-metric {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
    margin-bottom: 4px;
    padding: 3px 10px;
    background: rgba(57, 255, 20, 0.12);
    border-radius: 4px;
    font-size: 11px;
    color: var(--accent);
    font-weight: 700;
    border: 1px solid rgba(57, 255, 20, 0.2);
}

/* Color-coded metric types */
.ai-health-table td:nth-child(2) .metric-voltage {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: none;
}

.ai-health-table td:nth-child(2) .metric-frequency {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: none;
}

.ai-health-table td:nth-child(2) .metric-capacity {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: none;
}

.ai-health-table td:nth-child(2) .metric-temperature {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: none;
}

.ai-health-table td:nth-child(2) .metric-current {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: none;
}

.ai-health-table td:nth-child(2) .metric-percentage {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border-color: rgba(234, 179, 8, 0.3);
    box-shadow: none;
}

.ai-health-table td:nth-child(2) .metric-version {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
    border-color: rgba(236, 72, 153, 0.3);
    box-shadow: none;
}

.ai-health-table td:nth-child(2) .metric-resistance {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
    border-color: rgba(156, 163, 175, 0.3);
    box-shadow: none;
}

.ai-health-table td:nth-child(2) .metric-time {
    background: rgba(168, 162, 158, 0.15);
    color: #a8a29e;
    border-color: rgba(168, 162, 158, 0.3);
    box-shadow: none;
}

.ai-health-table td:nth-child(2) .metric-hex {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: none;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 10px;
}

.ai-health-table td:nth-child(2) .result-line {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.ai-health-table td:nth-child(2) .result-line:last-child {
    border-bottom: none;
}

/* Hover effect for table rows with detailed info */
.ai-health-table tbody tr:hover td:nth-child(2) {
    background: rgba(255, 255, 255, 0.01);
}

.ai-raw-logs pre {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

.ai-conclusion-info {
    background: rgba(59, 130, 246, 0.05) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

.ai-conclusion-info .ai-conclusion-title {
    color: #3b82f6;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    border: 1px solid transparent;
    white-space: nowrap;
}

.ai-badge svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.ai-badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.28);
}

.ai-badge-warning {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border-color: rgba(234, 179, 8, 0.28);
}

.ai-badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.28);
}

.ai-badge-neutral {
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.22);
}

.ai-badge-prominent {
    align-self: flex-start;
}

/* Conclusion Box */
.ai-conclusion-box {
    background: rgba(57, 255, 20, 0.05);
    border: 1px solid var(--accent-subtle);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
    text-align: left;
}

.ai-conclusion-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    text-align: left;
}

.ai-conclusion-verdict {
    flex: 1;
    min-width: 240px;
    font-size: clamp(18px, 1.5vw, 24px);
    line-height: 1.4;
    color: var(--text-primary);
    word-break: break-word;
}

.ai-alert-warning .ai-conclusion-title { color: #facc15; }
.ai-alert-error .ai-conclusion-title { color: #f87171; }

.ai-conclusion-success {
    background: rgba(34, 197, 94, 0.1) !important;
    border-color: #22c55e !important;
}

.ai-conclusion-warning {
    background: rgba(234, 179, 8, 0.1) !important;
    border-color: #facc15 !important;
}

.ai-conclusion-error {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: #ef4444 !important;
}

.ai-conclusion-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 12px;
    text-align: left;
    word-break: break-word;
}

:root:not([data-theme='light']) .ai-conclusion-box .ai-conclusion-title,
:root:not([data-theme='light']) .ai-conclusion-box .ai-conclusion-verdict,
:root:not([data-theme='light']) .ai-conclusion-box .ai-conclusion-text {
    color: #f8fafc !important;
}

:root:not([data-theme='light']) .ai-conclusion-box .ai-conclusion-text strong,
:root:not([data-theme='light']) .ai-conclusion-box .ai-conclusion-verdict strong {
    color: #ffffff !important;
}

.ai-action-plan {
    background: rgba(0,0,0,0.2);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.ai-action-plan code {
    font-family: Consolas, Courier New, monospace;
    color: var(--text-primary);
    background: rgba(0,0,0,0.3);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 10px;
}

.ai-alert-warning {
    background: rgba(234, 179, 8, 0.05);
    border-color: rgba(234, 179, 8, 0.2);
}

.ai-alert-error {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Error Fallback Card */
.ai-result-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    padding: 16px;
    text-align: left;
    margin-bottom: 12px;
}
.ai-card-content {
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 14px;
    gap: 10px;
    box-sizing: border-box;
}

.ai-progress-loading {
    width: 100%;
    align-items: stretch;
    padding: 20px 0 26px;
    gap: 14px;
    box-sizing: border-box;
}

.ai-progress-shell {
    width: 100%;
    max-width: none;
    display: grid;
    gap: 12px;
    --ai-progress-inline: 18px;
    box-sizing: border-box;
}

.ai-progress-terminal {
    width: 100%;
    display: grid;
    gap: 10px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(57, 255, 20, 0.14);
    background: linear-gradient(180deg, rgba(8, 16, 12, 0.96), rgba(10, 18, 14, 0.92));
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.03);
    overflow: hidden;
}

.ai-code-matrix {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.ai-code-cell {
    display: grid;
    gap: 4px;
    min-height: 68px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(57, 255, 20, 0.1);
    background: rgba(57, 255, 20, 0.035);
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.ai-code-cell.is-active {
    border-color: rgba(255, 80, 80, 0.38);
    background: rgba(255, 80, 80, 0.08);
    box-shadow: 0 0 0 1px rgba(255, 80, 80, 0.1), 0 0 18px rgba(255, 80, 80, 0.08);
}

.ai-code-cell-index {
    color: rgba(157, 252, 169, 0.64);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.ai-code-cell-value {
    color: #d9ffe1;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.ai-code-cell-subvalue {
    color: rgba(217, 255, 225, 0.72);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.ai-progress-terminal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ai-progress-terminal-title {
    font-size: 13px;
    font-weight: 700;
    color: #d9ffe1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ai-progress-terminal-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(57, 255, 20, 0.12);
    border: 1px solid rgba(57, 255, 20, 0.18);
    color: #8cff93;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    font-weight: 700;
}

.ai-progress-stream {
    display: grid;
    gap: 8px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    color: #9dfca9;
}

.ai-progress-line {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-progress-prefix {
    color: #39ff14;
    font-weight: 700;
    flex: 0 0 auto;
}

.ai-progress-caret {
    width: 8px;
    height: 14px;
    background: #39ff14;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
    animation: ai-progress-blink 0.85s steps(1) infinite;
    flex: 0 0 auto;
}

@keyframes ai-progress-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.15; }
}

:root[data-theme='light'] .ai-progress-terminal {
    background: linear-gradient(180deg, rgba(245, 255, 247, 0.98), rgba(238, 250, 241, 0.96));
    border-color: rgba(34, 197, 94, 0.18);
}

:root[data-theme='light'] .ai-code-cell {
    background: rgba(22, 163, 74, 0.05);
    border-color: rgba(22, 163, 74, 0.1);
}

:root[data-theme='light'] .ai-code-cell.is-active {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}

:root[data-theme='light'] .ai-code-cell-index {
    color: rgba(21, 128, 61, 0.72);
}

:root[data-theme='light'] .ai-code-cell-value {
    color: #166534;
}

:root[data-theme='light'] .ai-code-cell-subvalue {
    color: #15803d;
}

:root[data-theme='light'] .ai-progress-terminal-title {
    color: #166534;
}

:root[data-theme='light'] .ai-progress-terminal-status,
:root[data-theme='light'] .ai-progress-prefix,
:root[data-theme='light'] .ai-progress-stream {
    color: #15803d;
}

:root[data-theme='light'] .ai-progress-caret {
    background: #16a34a;
}

.ai-progress-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: calc(100% - (var(--ai-progress-inline) * 2));
    margin: 0 auto;
}

.ai-progress-stats {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ai-progress-percent,
.ai-progress-time {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(57, 255, 20, 0.2);
    background: rgba(57, 255, 20, 0.08);
    color: var(--accent);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    font-weight: 700;
}

.ai-progress-bar {
    position: relative;
    width: calc(100% - (var(--ai-progress-inline) * 2));
    margin: 0 auto;
    height: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(57, 255, 20, 0.72) 0%, rgba(132, 255, 112, 0.96) 100%);
    box-shadow: 0 0 18px rgba(57, 255, 20, 0.22);
    transition: width 0.24s ease;
}

.ai-progress-caption {
    flex: 1 1 auto;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .ai-progress-shell {
        --ai-progress-inline: 12px;
    }

    .ai-code-matrix {
        grid-template-columns: 1fr 1fr;
    }

    .ai-progress-terminal-head,
    .ai-progress-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-progress-stats {
        justify-content: flex-start;
    }

    .ai-progress-line {
        font-size: 11px;
    }
}

@media (min-width: 1180px) and (max-height: 1120px) {
    :root {
        --app-shell-gap: 16px;
        --app-shell-pad-y: 12px;
        --app-shell-pad-x: 18px;
        --panel-pad: 16px;
        --analysis-input-min-height: 120px;
        --output-min-height: 220px;
    }

    .logo-container {
        margin-bottom: 12px;
        padding: 4px 0;
    }

    .logo-img {
        max-height: 38px;
    }

    .status-bar {
        margin-bottom: 12px;
        padding: 8px 12px;
    }

    .cloud-dashboard {
        grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
        gap: 10px;
        margin-bottom: 12px;
    }

    .cloud-card,
    .analysis-import-panel {
        padding: 12px;
    }

    .cloud-redeem-panel,
    .advanced-settings-wrapper {
        padding: 10px;
    }

    .cloud-balance-value {
        font-size: clamp(26px, 3vw, 34px);
    }

    .settings-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 12px;
        padding: 12px;
    }

    .advanced-settings-grid {
        gap: 10px;
    }

    .advanced-setting-card {
        padding: 10px;
    }

    .button-group {
        gap: 8px;
        margin-bottom: 12px;
    }

    .checkbox-container {
        margin-top: 8px;
        padding: 8px 12px;
    }

    .analysis-import-head {
        gap: 10px;
        margin-bottom: 10px;
    }

    .analysis-import-actions {
        display: block;
    }

    .analysis-action-btn {
        min-height: 38px;
    }

    .analysis-drop-zone {
        padding: 12px;
    }

    .analysis-drop-zone-title {
        font-size: 15px;
    }

    .analysis-import-textarea.is-expanded {
        max-height: 24vh;
    }

    .analysis-drop-guide {
        padding: 9px 10px;
    }

    .analysis-drop-overlay-title {
        font-size: 18px;
    }

    .ai-panel-header {
        margin-bottom: 14px;
        padding-bottom: 12px;
    }

    .ai-title-gradient {
        font-size: 1.35rem;
        margin-bottom: 6px;
    }

    .ai-subtitle {
        margin-bottom: 8px;
        letter-spacing: 0.16em;
    }

    .ai-toolbar {
        margin-bottom: 12px;
    }

    .btn-analyze {
        padding: 10px 22px;
    }

    .ai-overview-grid,
    .ai-info-cards-grid {
        gap: 14px;
    }

    .ai-overview-grid {
        margin-bottom: 20px;
    }

    .ai-detail-grid {
        gap: 12px;
        margin-bottom: 16px;
    }

    .ai-metric-card {
        min-height: 180px;
        padding: 16px 18px;
        gap: 10px;
    }

    .ai-info-card,
    .ai-detail-card {
        padding: 14px;
    }

    .ai-section-title {
        margin: 18px 0 12px;
        padding-bottom: 8px;
    }
}

@media (max-width: 1024px) {
    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .app-wrapper {
        flex-direction: column;
        height: auto;
        min-height: auto;
        padding: 12px;
    }
    
    .container {
        max-width: 100%;
        height: auto;
        min-height: 600px;
    }
    
    .ai-panel {
        flex: none;
        max-width: 100%;
        height: 600px;
        margin-top: 10px;
    }
}

@media (max-width: 900px) {
    .settings-panel {
        grid-template-columns: repeat(2, 1fr);
    }

    .advanced-settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .ai-panel::before,
    .ai-panel::after {
        display: none;
        content: none;
    }

    .app-wrapper {
        padding: 0;
    }

    .container {
        min-height: auto;
    }

    .ai-panel {
        --ai-header-stack-width: 124px;
        height: auto;
        min-height: 0;
        padding: 12px 14px 16px;
        overflow: visible;
    }

    .ai-results {
        overflow: visible;
        padding-right: 0;
        gap: 10px;
    }

    .ai-panel-header {
        min-height: 0;
        margin-bottom: 12px;
        padding: 0 0 12px 0;
        display: grid;
        gap: 10px;
    }

    .ai-title-gradient {
        font-size: clamp(1.05rem, 6.2vw, 1.4rem);
        line-height: 1.25;
        margin: 0;
        max-width: calc(100% - 8px);
    }

    .ai-subtitle {
        margin: 0;
        font-size: 10px;
        letter-spacing: 0.18em;
    }

    .ai-panel-header-actions {
        margin-bottom: 0;
    }

    .analysis-import-panel {
        padding-right: 12px;
    }

    .analysis-import-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }

    .analysis-panel-toggle-btn {
        position: static;
        top: auto;
        right: auto;
        margin-left: auto;
    }

    .analysis-mode-field,
    .analysis-mode-select,
    .analysis-drop-zone {
        width: 100%;
        min-width: 0;
    }

    .analysis-import-panel.is-collapsed {
        position: static;
        width: var(--ai-header-stack-width);
        min-width: var(--ai-header-stack-width);
        max-width: var(--ai-header-stack-width);
        margin: 0 0 2px 0;
    }

    .analysis-import-panel.is-collapsed #toggleAnalysisPanelBtn {
        min-height: 40px;
        font-size: 11px;
    }

    .ai-section-title {
        margin: 14px 0 10px;
        padding-bottom: 8px;
        font-size: 12px;
        letter-spacing: 0.06em;
        gap: 8px;
    }

    .ai-section-title svg {
        width: 16px;
        height: 16px;
    }

    .ai-conclusion-box {
        padding: 16px 16px 15px;
        margin-bottom: 12px;
        border-radius: 16px;
    }

    .ai-conclusion-title {
        margin-bottom: 10px;
        gap: 8px;
    }

    .ai-conclusion-verdict {
        min-width: 0;
        font-size: 1.05rem;
        line-height: 1.4;
    }

    .ai-conclusion-text {
        font-size: 14px;
        line-height: 1.75;
        margin-bottom: 0;
    }

    .ai-overview-grid,
    .ai-info-cards-grid,
    .ai-detail-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 14px;
    }

    .ai-metric-card,
    .ai-info-card,
    .ai-detail-card,
    .ai-result-card {
        border-radius: 16px;
    }

    .ai-metric-card {
        min-height: 0;
        padding: 16px;
        gap: 10px;
    }

    .ai-card-header {
        gap: 10px;
        font-size: 11px;
        letter-spacing: 0.06em;
    }

    .ai-card-value {
        font-size: clamp(24px, 8vw, 34px);
        line-height: 1.15;
    }

    .ai-info-card,
    .ai-detail-card {
        padding: 14px;
    }

    .ai-progress-loading {
        padding: 8px 0 18px;
        gap: 10px;
    }

    .ai-progress-shell {
        gap: 10px;
        --ai-progress-inline: 0px;
    }

    .ai-progress-terminal {
        padding: 14px;
        gap: 8px;
        border-radius: 16px;
    }

    .ai-code-matrix {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .ai-code-cell {
        min-height: 58px;
        padding: 8px;
    }

    .ai-progress-terminal-head,
    .ai-progress-footer {
        gap: 8px;
    }

    .ai-progress-stats {
        width: 100%;
        justify-content: space-between;
    }

    .ai-progress-bar,
    .ai-progress-caption {
        width: 100%;
    }

    .logo-container {
        order: 1;
    }

    .cloud-dashboard {
        order: 2;
    }

    .status-bar {
        order: 3;
    }

    .settings-panel {
        order: 4;
    }

    .button-group {
        order: 5;
    }

    .output-container {
        order: 6;
    }

    .container {
        padding: 12px;
        border-radius: 0;
    }

    .logo-container {
        justify-content: flex-start;
        align-items: center;
        gap: 8px;
        padding: 6px 0 12px;
    }

    .logo-img {
        max-width: 150px;
        max-height: 34px;
        margin-right: auto;
    }

    .logo-container #historyBtn,
    .logo-container #themeToggleBtn,
    .logo-container .logo-language-selector {
        position: relative;
        transform: none;
        display: inline-flex;
        align-items: center;
        flex: 0 0 auto;
        order: 2;
    }

    .logo-container #themeToggleBtn {
        order: 3;
        width: 34px;
        height: 34px;
        min-height: 34px;
        padding: 0;
    }

    .logo-container #historyBtn {
        order: 2;
        min-height: 34px;
        padding: 0 10px;
        gap: 6px;
        font-size: 10px;
    }

    .logo-language-selector {
        order: 4;
    }

    .logo-language-selector select {
        width: 108px;
        min-width: 108px;
        height: 34px;
        padding: 0 30px 0 30px;
        font-size: 10px;
    }

    .logo-language-icon {
        left: 10px;
        width: 12px;
        height: 12px;
    }

    body {
        padding: 0;
    }

    h1 {
        font-size: 1.25rem;
    }

    .settings-panel {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 12px;
    }

    .baud-rate-control {
        grid-template-columns: 1fr;
    }

    .advanced-settings-wrapper {
        padding: 12px;
    }

    .advanced-settings-toggle {
        align-items: flex-start;
    }

    .advanced-settings-summary {
        font-size: 10px;
    }

    .advanced-settings-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .status-bar {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .status-indicator {
        display: none;
    }

    .status-actions {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .auth-panel {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        min-width: 0;
    }

    .auth-user {
        width: 100%;
    }

    .mobile-points-badge {
        display: none;
    }

    .mobile-points-modal {
        display: block;
    }

    .cloud-balance-card {
        display: none;
    }

    .auth-actions {
        width: 100%;
    }

    .output-container {
        min-height: 28px;
        flex: 0 0 auto;
        position: relative;
    }

    #output {
        min-height: 28px;
        height: 28px;
        padding: 5px 64px 5px 8px;
        line-height: 1.2;
        font-size: 10px;
        overflow-y: hidden;
    }

    #output.is-mobile-expanded {
        min-height: 120px;
        height: 120px;
        padding-top: 30px;
        overflow-y: auto;
    }

    .output-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 4px;
        right: 4px;
        z-index: 2;
        min-height: 28px;
        padding: 0 10px;
        font-size: 10px;
    }

    .auth-modal-card {
        margin: auto;
        gap: 14px;
        padding: 18px;
        border-radius: 20px;
    }

    .auth-modal-kicker {
        min-height: 24px;
        padding: 0 10px;
        font-size: 9px;
    }

    .auth-modal-header {
        gap: 12px;
        padding-bottom: 6px;
    }

    .auth-modal-title {
        font-size: 24px;
    }

    .auth-modal-hint {
        font-size: 12px;
    }

    .auth-modal-section {
        padding: 0;
    }

    .auth-modal-switches {
        grid-template-columns: 1fr;
    }

    .auth-code-row {
        grid-template-columns: 1fr;
    }

    .auth-code-btn {
        width: 100%;
    }

    .cloud-dashboard {
        grid-template-columns: 1fr;
    }

    .cloud-balance-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .redeem-row {
        grid-template-columns: 1fr;
    }

    .cloud-redeem-btn {
        width: 100%;
    }

    .analysis-import-head,
    .ai-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-panel-header {
        padding-right: 0;
    }

    .ai-panel-header-actions {
        position: static;
        justify-content: space-between;
        margin-bottom: 16px;
        flex-wrap: nowrap;
        width: var(--ai-header-stack-width);
        min-width: var(--ai-header-stack-width);
        max-width: var(--ai-header-stack-width);
        margin-left: auto;
        margin-right: auto;
    }

    .ai-toolbar-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .analysis-drop-zone-top {
        grid-template-columns: 1fr;
    }

    .analysis-drop-zone-actions {
        justify-content: stretch;
    }

    .analysis-drop-zone-actions .analysis-action-btn {
        flex: 1 1 auto;
    }

    .analysis-mode-field {
        width: 100%;
    }

    .ai-detail-grid {
        grid-template-columns: 1fr;
    }

    .admin-center {
        grid-template-columns: 1fr;
    }

    .admin-panel-wide {
        grid-column: auto;
    }

    .button-group {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .button-group button {
        flex: 1;
        min-width: 80px;
        padding: 12px 8px;
    }

    .input-container {
        flex-direction: column;
    }

    #input {
        width: 100%;
    }

    #sendButton {
        width: 100%;
    }

    #output {
        height: 400px;
        font-size: 11px;
    }
}

/* History Drawer */
.history-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: min(400px, calc(100vw - 24px));
    height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(57, 255, 20, 0.08), transparent 30%),
        linear-gradient(180deg, rgba(15, 19, 20, 0.98), rgba(10, 13, 15, 0.98));
    border-left: 1px solid rgba(57, 255, 20, 0.12);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -24px 0 64px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    padding: 20px 18px 18px;
    backdrop-filter: blur(18px);
}

.history-drawer.open {
    right: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 0 2px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.history-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.history-close-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.history-close-btn:hover {
    border-color: rgba(57, 255, 20, 0.22);
    background: rgba(57, 255, 20, 0.08);
    color: var(--accent);
}

.history-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background:
        radial-gradient(circle at top left, rgba(57, 255, 20, 0.08), transparent 44%),
        linear-gradient(180deg, rgba(57, 255, 20, 0.05), rgba(57, 255, 20, 0.015));
}

.history-search-input,
.history-filter-select {
    width: 100%;
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(8, 11, 13, 0.8);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12px;
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.03);
}

.history-search-input:focus,
.history-filter-select:focus {
    outline: none;
    border-color: rgba(57, 255, 20, 0.28);
}

.history-filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.history-count-label {
    width: fit-content;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-align: left;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(57, 255, 20, 0.18);
    background: rgba(57, 255, 20, 0.08);
    display: inline-flex;
    align-items: center;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 2px;
}

.history-item {
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(24, 29, 31, 0.92), rgba(17, 21, 24, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    padding: 15px 14px 16px;
    gap: 12px;
    min-height: 156px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
    overflow: hidden;
}

.history-item:hover {
    border-color: rgba(57, 255, 20, 0.22);
    background: linear-gradient(180deg, rgba(28, 34, 36, 0.96), rgba(18, 23, 25, 0.96));
}

.history-item-time {
    font-size: 11px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    line-height: 1.5;
    white-space: nowrap;
}

.history-item-meta-row {
    display: flex;
    gap: 10px;
}

.history-item-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 12px;
    row-gap: 10px;
}

.history-item-heading {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.history-item-title {
    display: block;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

.history-item-preview {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    min-height: calc(1.6em * 2);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.history-item-preview.status-warning {
    color: #f5c15b;
}

.history-item-preview.status-error {
    color: #ff9d9d;
}

.history-item-meta-row {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
}

.history-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 8px;
    flex: 0 0 auto;
}

.history-item-action-buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.history-item-time,
.history-item-preview,
.history-item-status-badge,
.history-item-edit,
.history-item-delete {
    position: relative;
    z-index: 1;
}

.history-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    min-width: 0;
}

.history-item-points,
.history-item-status,
.history-item-type-chip {
    font-size: 11px;
    color: var(--text-secondary);
}

.history-item-points {
    color: var(--accent);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    white-space: nowrap;
}

.history-item-type-chip,
.history-item-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1;
    vertical-align: middle;
}

.history-item-type-chip.type-apple {
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.25);
    background: rgba(56, 189, 248, 0.12);
}

.history-item-type-chip.type-android {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.24);
    background: rgba(245, 158, 11, 0.12);
}

.history-item-type-chip.type-boot {
    color: #a78bfa;
    border-color: rgba(167, 139, 250, 0.24);
    background: rgba(167, 139, 250, 0.12);
}

.history-item-status-badge.status-success {
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.24);
    background: rgba(34, 197, 94, 0.12);
}

.history-item-status-badge.status-warning {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.24);
    background: rgba(245, 158, 11, 0.12);
}

.history-item-status-badge.status-error {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.24);
    background: rgba(239, 68, 68, 0.12);
}

.history-item-status-badge.status-neutral {
    color: var(--text-secondary);
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(148, 163, 184, 0.08);
}

.history-item-edit {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border-radius: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.history-item-delete {
    border: 1px solid rgba(239, 68, 68, 0.18);
    background: rgba(239, 68, 68, 0.08);
    color: #ff8a8a;
    border-radius: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.history-item-edit .icon-svg {
    width: 14px;
    height: 14px;
}

.history-item-delete .icon-svg {
    width: 14px;
    height: 14px;
}

.history-item-edit:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(57, 255, 20, 0.08);
}

.history-item-delete:hover {
    border-color: rgba(239, 68, 68, 0.36);
    background: rgba(239, 68, 68, 0.14);
    color: #ff6b6b;
}

.history-empty-state {
    text-align: center;
    color: var(--text-muted);
    margin-top: 6px;
    font-size: 12px;
    padding: 24px 16px;
    border-radius: 18px;
    border: 1px dashed rgba(57, 255, 20, 0.16);
    background: rgba(57, 255, 20, 0.04);
}

.history-footer {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.history-clear-btn {
    width: 100%;
    min-height: 42px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
}

:root[data-theme='light'] .history-drawer {
    background:
        radial-gradient(circle at top right, rgba(13, 159, 110, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 247, 250, 0.98));
    border-left-color: rgba(15, 23, 42, 0.08);
    box-shadow: -24px 0 64px rgba(15, 23, 42, 0.12);
}

:root[data-theme='light'] .history-toolbar,
:root[data-theme='light'] .history-item {
    border-color: rgba(15, 23, 42, 0.08);
}

:root[data-theme='light'] .history-toolbar {
    background:
        radial-gradient(circle at top left, rgba(13, 159, 110, 0.08), transparent 44%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 252, 0.96));
}

:root[data-theme='light'] .history-search-input,
:root[data-theme='light'] .history-filter-select {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(15, 23, 42, 0.08);
}

:root[data-theme='light'] .history-close-btn,
:root[data-theme='light'] .history-item-edit {
    border-color: rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 252, 0.92);
    color: #64748b;
}

:root[data-theme='light'] .history-item-delete {
    border-color: rgba(239, 68, 68, 0.18);
    background: rgba(254, 242, 242, 0.96);
    color: #dc2626;
}

:root[data-theme='light'] .history-item {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 250, 0.96));
}

:root[data-theme='light'] .history-empty-state {
    border-color: rgba(13, 159, 110, 0.18);
    background: rgba(13, 159, 110, 0.05);
}

@media (max-width: 480px) {
    .history-filter-row {
        grid-template-columns: 1fr;
    }

    .history-item-top {
        grid-template-columns: 1fr;
    }

    .history-item-actions {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .history-item {
        min-height: 172px;
    }

    .history-item-footer {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .history-item-meta-row {
        min-width: 0;
    }
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.drawer-overlay.active {
    display: block;
}

/* Theme Toggle Button */
.theme-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 100 !important;
    pointer-events: auto !important;
}

.icon-svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    display: block;
}

.theme-btn.with-label {
    gap: 6px;
    border-radius: 999px;
    padding: 8px 12px;
}

.theme-btn .icon-svg {
    width: 18px;
    height: 18px;
}

.theme-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
}

.btn-icon-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Analyze Button */
.btn-analyze {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    padding: 12px 28px;
    background: var(--accent);
    color: #000000;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: none;
    text-shadow: none;
    z-index: 100 !important;
    pointer-events: auto !important;
}

:root[data-theme='light'] .btn-analyze {
    color: #ffffff;
}

.btn-analyze:hover {
    transform: translateY(-2px);
    box-shadow: none;
}

.btn-analyze:active {
    transform: translateY(0);
}

.btn-analyze-icon {
    display: flex;
    align-items: center;
}

.btn-analyze-icon svg {
    width: 18px;
    height: 18px;
}

.btn-analyze-text {
    position: relative;
    z-index: 1;
}

.btn-analyze-cost {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.btn-analyze-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: transparent;
    animation: btnGlow 2s infinite;
}

@keyframes btnGlow {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.btn-analyze:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-analyze:disabled .btn-analyze-glow {
    animation: none;
}

/* Unified Radius System */
.container,
.ai-panel,
.auth-modal-card,
.announcement-modal-card {
    border-radius: var(--radius-xl);
}

.cloud-card,
.settings-panel,
.advanced-settings-wrapper,
.analysis-import-panel,
.analysis-drop-zone,
.analysis-drop-guide,
.status-bar,
.status-indicator,
.auth-panel,
.auth-user,
.history-toolbar,
.history-item,
.announcement-item,
.announcement-detail-card,
.auth-empty-state,
.history-empty-state,
.announcement-list,
.auth-modal-switches {
    border-radius: var(--radius-lg);
}

.history-drawer {
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-analyze,
.theme-btn,
.analysis-action-btn,
.auth-btn,
.auth-entry-btn,
.auth-mode-btn,
.auth-menu-logout-btn,
.auth-code-btn,
.auth-submit-btn,
.auth-google-btn,
.auth-dev-modal-btn,
.advanced-settings-toggle,
.history-item-edit,
.history-item-delete,
.auth-modal-close-btn,
.auth-menu-btn,
.ai-panel-header-actions .ai-header-tool {
    border-radius: var(--radius);
}

input[type='text'],
input[type='email'],
input[type='search'],
input[type='number'],
input[type='password'],
select,
textarea,
.email-auth-input,
.email-auth-code,
.history-search-input,
.history-filter-select,
.analysis-mode-select,
.analysis-import-textarea,
.logo-language-selector select,
.language-selector select,
.redeem-input,
#output {
    border-radius: var(--radius);
}

.history-count-label,
.analysis-drop-zone-badge,
.history-item-type-chip,
.history-item-status-badge,
.announcement-type,
.cloud-balance-badge,
.auth-modal-kicker,
.auth-google-mark,
.auth-avatar {
    border-radius: var(--radius-pill);
}
