/* ===== COMMON ===== */
.card {
    background: linear-gradient(145deg, #1d1b2c 0%, #14131e 100%);
    border: 1px solid rgba(155,114,245,0.18);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.03);
    transition: box-shadow 0.25s;
}
.card:hover {
    box-shadow: 0 4px 28px rgba(0,0,0,0.4), 0 0 0 1px rgba(155,114,245,0.14), inset 0 1px 0 rgba(255,255,255,0.04);
}

.card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

/* Today's Action Panel */
.today-action-card {
    background: linear-gradient(135deg, rgba(155, 114, 245, 0.1) 0%, rgba(155, 114, 245, 0.05) 100%);
    border: 1px solid var(--gold-dim);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.today-action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gold);
}

.today-badge {
    background: var(--gold);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    margin-right: 8px;
    text-transform: uppercase;
}

.action-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(155, 114, 245, 0.1);
}

.action-item:last-child {
    border-bottom: none;
}

.action-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.action-content {
    flex: 1;
}

.action-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.action-desc {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.5;
}

.input {
    width: 100%;
    background: var(--dark3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.input:focus {
    border-color: var(--gold);
}

.btn {
    background: linear-gradient(135deg, #9B72F5 0%, #7c5cbf 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(155,114,245,0.3);
}

.btn:hover {
    box-shadow: 0 4px 18px rgba(155,114,245,0.45);
    transform: translateY(-1px);
    opacity: 0.95;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold-dim);
}

.btn-outline:hover {
    background: rgba(155, 114, 245, 0.08);
}

/* ===== MODERN BUTTON VARIANTS ===== */
/* Primary: gradient purple glow */
.btn-primary {
    background: linear-gradient(135deg, #9B72F5 0%, #7c5cbf 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(155, 114, 245, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(155, 114, 245, 0.5);
    transform: translateY(-1px);
    opacity: 0.95;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 6px rgba(155, 114, 245, 0.2);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Ghost: subtle border, fills on hover */
.btn-ghost {
    background: transparent;
    color: var(--gold);
    border: 1px solid rgba(155, 114, 245, 0.35);
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background: rgba(155, 114, 245, 0.1);
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(155, 114, 245, 0.2);
}

/* AI badge button: neon green accent */
.btn-ai {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(5, 150, 105, 0.3);
}

.btn-ai:hover {
    box-shadow: 0 4px 20px rgba(5, 150, 105, 0.4);
    transform: translateY(-1px);
}

.btn-ai:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Small size modifier */
.btn-sm {
    padding: 5px 12px;
    font-size: 11px;
    border-radius: 6px;
}

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

.status-ok {
    color: var(--ok);
    font-size: 12px;
}

.form-label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 5px;
    display: block;
}

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

select.input {
    cursor: pointer;
}

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

/* ===== UPLOAD ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 36px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--gold);
    background: rgba(155, 114, 245, 0.04);
}

.upload-area.dragover {
    border-color: var(--gold);
    background: rgba(155, 114, 245, 0.08);
}

.upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.upload-text {
    font-size: 13px;
    color: var(--muted);
}

.upload-hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    opacity: 0.6;
}

.file-list {
    margin-top: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--dark3);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 6px;
}

.file-name {
    flex: 1;
    font-size: 12px;
    color: var(--text);
}

.file-size {
    font-size: 11px;
    color: var(--muted);
}

.file-rm {
    cursor: pointer;
    color: var(--muted);
    font-size: 16px;
    padding: 0 4px;
}

.file-rm:hover {
    color: var(--danger);
}

/* ===== ANALYZE BTN ===== */
.analyze-wrap {
    text-align: center;
    margin: 8px 0 4px;
}

.analyze-btn {
    font-size: 15px;
    padding: 14px 48px;
    border-radius: 10px;
}

/* ===== LOADING ===== */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
    margin-bottom: 20px;
}

.loading.active {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-text {
    color: var(--muted);
    font-size: 13px;
}

/* ===== ERROR ===== */
.error {
    display: none;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 16px;
}

.error.active {
    display: block;
}

/* ===== RESULTS ===== */
.results {
    display: none;
}

.results.active {
    display: block;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.sum-card {
    background: var(--dark2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.sum-label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 6px;
}

.sum-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--gold);
}

.sum-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

/* ===== CHART ===== */
.chart-card {
    background: var(--dark2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
    padding-bottom: 24px;
    position: relative;
}

.bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
}

.bar-val {
    font-size: 9px;
    color: var(--muted);
    margin-bottom: 3px;
    white-space: nowrap;
}

.bar {
    background: var(--gold);
    border-radius: 3px 3px 0 0;
    width: 100%;
    transition: height 0.3s;
}

.bar-lbl {
    font-size: 9px;
    color: var(--muted);
    margin-top: 4px;
    white-space: nowrap;
}

/* ===== TABS ===== */
.tabs-card {
    background: linear-gradient(145deg, #1d1b2c 0%, #14131e 100%);
    border: 1px solid rgba(155,114,245,0.18);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.03);
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    margin-bottom: -1px;
}

.tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ===== TABLE ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.table th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 8px;
    border-bottom: 1px solid rgba(155, 114, 245, 0.06);
}

.table td.rank {
    color: var(--muted);
    font-size: 11px;
    width: 24px;
}

.table td.pname {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table td.right {
    text-align: right;
}

.table tr:hover td {
    background: rgba(155, 114, 245, 0.04);
}

/* ===== COUPON ===== */
.cprow {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(155, 114, 245, 0.07);
    font-size: 12px;
}

.cprow:last-child {
    border: none;
}

.cpname {
    flex: 1;
    color: var(--text);
}

.cpcount {
    color: var(--muted);
    margin-right: 16px;
}

.cpamt {
    color: var(--danger);
    font-weight: 700;
}

/* ===== MAILMAG ===== */
.mailmag-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.mailmag-out {
    background: var(--dark3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    min-height: 200px;
    display: none;
    margin-top: 16px;
}

.copy-btn {
    float: right;
    margin-top: 10px;
    display: none;
}

/* ===== AI ===== */
.ai-card {
    background: var(--dark2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.ai-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ai-badge {
    font-size: 10px;
    color: var(--gold);
    border: 1px solid var(--gold-dim);
    padding: 2px 8px;
    border-radius: 10px;
}

.ai-body {
    font-size: 13px;
    line-height: 1.9;
    color: var(--text);
}

.ai-body .hl {
    color: var(--gold);
    font-weight: 700;
}

/* ===== IMAGE UPLOAD ===== */
.img-upload {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--dark3);
}

.img-upload:hover {
    border-color: var(--gold-dim);
}

.img-preview {
    max-width: 100%;
    max-height: 160px;
    border-radius: 6px;
    display: none;
}

.img-reading {
    display: none;
    color: var(--muted);
    font-size: 12px;
    margin-top: 8px;
}

.img-reading.active {
    display: block;
}

.img-ok {
    display: none;
    color: var(--ok);
    font-size: 12px;
    margin-top: 8px;
}

.img-ok.active {
    display: block;
}

/* ===== LOGIN ===== */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 360px;
    padding: 48px 40px;
    background: linear-gradient(160deg, #1e1b30 0%, #13121e 100%);
    border: 1px solid rgba(155,114,245,0.3);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 0 80px rgba(155,114,245,0.2), 0 0 0 1px rgba(255,255,255,0.04) inset;
}

.login-logo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 60px;
    letter-spacing: 0.12em;
    text-align: center;
    line-height: 1;
    background: linear-gradient(135deg, #e0d0ff 0%, #9B72F5 50%, #6d4fc2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 11px;
    margin-top: -8px;
    letter-spacing: 0.08em;
}

.login-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.login-btn {
    width: 100%;
    padding: 13px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 10px;
    letter-spacing: 0.05em;
}

.login-error {
    color: var(--danger);
    font-size: 12px;
    min-height: 16px;
    text-align: center;
}

.logout-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: inherit;
    transition: color 0.15s;
}

.logout-btn:hover {
    color: var(--text);
}