:root {
    --bg: #0b1120;
    --surface: #151b2b;
    --surface-alt: #1e2638;
    --surface-hover: #1a2233;
    --sidebar-bg: #0f1626;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-text: #60a5fa;
    --primary-soft: rgba(59, 130, 246, 0.12);
    --primary-border: rgba(59, 130, 246, 0.35);
    --text: #f1f5f9;
    --text-body: #cbd5e1;
    --text-muted: #7c8aa5;
    --border: #283248;
    --border-strong: #3a4561;
    --success: #4ade80;
    --success-soft: rgba(34, 197, 94, 0.12);
    --success-border: rgba(34, 197, 94, 0.32);
    --warning: #fbbf24;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --warning-border: rgba(245, 158, 11, 0.32);
    --danger: #f87171;
    --danger-soft: rgba(239, 68, 68, 0.12);
    --danger-border: rgba(239, 68, 68, 0.32);
    --info: #60a5fa;
    --info-soft: rgba(59, 130, 246, 0.12);
    --info-border: rgba(59, 130, 246, 0.32);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --transition: 150ms ease;
}

[data-theme="light"] {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-alt: #f1f5f9;
    --surface-hover: #f1f5f9;
    --sidebar-bg: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-text: #2563eb;
    --primary-soft: #eff6ff;
    --primary-border: #bfdbfe;
    --text: #0f172a;
    --text-body: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --success: #16a34a;
    --success-soft: #f0fdf4;
    --success-border: #bbf7d0;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --warning-border: #fde68a;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;
    --info: #0284c7;
    --info-soft: #f0f9ff;
    --info-border: #bae6fd;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
}

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

html,
body {
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

body {
    background: var(--bg);
    color: var(--text-body);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100vh;
    height: 100dvh;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 248px;
    min-width: 248px;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-body {
    min-height: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 22px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-header span {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.sidebar-nav {
    padding: 14px 12px;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-body);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}

.sidebar-nav li a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition);
}

.sidebar-nav li a:hover {
    color: var(--text);
    background: var(--surface-alt);
}

.sidebar-nav li a:hover svg {
    color: var(--text-body);
}

.sidebar-nav li a.active {
    color: var(--primary-text);
    background: var(--primary-soft);
    font-weight: 600;
}

.sidebar-nav li a.active svg {
    color: var(--primary-text);
}

.sidebar-footer {
    grid-row: 2;
    width: 100%;
    border-top: 1px solid var(--border);
    background: var(--sidebar-bg);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar .sidebar-logout,
.sidebar .sidebar-test-mode {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    text-decoration: none;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
    box-sizing: border-box;
}

.sidebar .sidebar-logout svg,
.sidebar .sidebar-test-mode svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar .sidebar-test-mode {
    color: var(--warning);
}

.sidebar .sidebar-test-mode:hover,
.sidebar .sidebar-test-mode.active {
    background: var(--warning-soft);
    color: var(--warning);
}

.sidebar .sidebar-logout {
    color: var(--danger);
}

.sidebar .sidebar-logout:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.main-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 32px 40px;
}

.page-header {
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-header p {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-muted);
}

.content-area {
    font-size: 14px;
    color: var(--text-body);
    line-height: 1.6;
}

.info-box {
    padding: 18px 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-body);
    max-width: 640px;
}

.info-box strong {
    color: var(--text);
    font-weight: 600;
}

.info-box code {
    color: var(--primary-text);
    background: var(--primary-soft);
    border: 1px solid var(--primary-border);
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 13px;
}

.info-box a {
    color: var(--primary-text);
    text-decoration: none;
}

.info-box a:hover {
    text-decoration: underline;
}

.alert {
    padding: 14px 18px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.5;
}

.alert-success {
    color: var(--success);
    border-color: var(--success-border);
    background: var(--success-soft);
}

.alert-error {
    color: var(--danger);
    border-color: var(--danger-border);
    background: var(--danger-soft);
}

.alert-warning {
    color: var(--warning);
    border-color: var(--warning-border);
    background: var(--warning-soft);
}

.sms-form {
    max-width: 560px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.form-input,
.form-textarea {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    padding: 11px 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:hover,
.form-textarea:hover {
    border-color: var(--text-muted);
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

.form-input:disabled,
.form-textarea:disabled {
    background: var(--surface-alt);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

.char-count {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    text-align: right;
    color: var(--text-muted);
}

.form-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    padding: 11px 22px;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.form-submit:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

.form-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.form-submit:disabled {
    background: var(--text-muted);
    border-color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.panel-section {
    margin-bottom: 36px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 18px;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c8aa5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 38px;
}

.form-textarea-sm {
    min-height: 90px;
}

.empty-text {
    color: var(--text-muted);
    font-size: 14px;
}

.data-table {
    width: 100%;
    max-width: 760px;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-body);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--surface-alt);
}

.data-table tbody tr:hover {
    background: var(--surface-hover);
}

a[x-apple-data-detectors],
.data-table a,
.data-table a:link,
.data-table a:visited,
.data-table a:hover,
.data-table a:active {
    color: inherit !important;
    text-decoration: none !important;
    pointer-events: none;
}

.data-table-wide {
    max-width: 100%;
}

.table-scroll {
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.dashboard-page {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.dashboard-page .page-header {
    flex-shrink: 0;
}

.dashboard-page .dashboard-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dashboard-page .alert,
.dashboard-page .stats-grid {
    flex-shrink: 0;
}

.dashboard-page .stats-grid {
    margin-bottom: 24px;
}

.dashboard-page .dashboard-table-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0;
}

.dashboard-page .dashboard-table-section .section-title-row {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.dashboard-page .dashboard-table-section .section-title {
    flex-shrink: 0;
    margin-bottom: 0;
}

.user-filter-tags {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.user-filter-tag {
    display: inline-block;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-body);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.user-filter-tag:hover {
    color: var(--primary-text);
    border-color: var(--primary-border);
    background: var(--primary-soft);
}

.user-filter-tag.active {
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}

.section-count {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.report-pdf-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-body);
    text-decoration: none;
    background: var(--surface);
    padding: 0;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.report-pdf-link:hover {
    background: var(--primary-soft);
    border-color: var(--primary-border);
    color: var(--primary-text);
}

.report-date-box {
    max-width: 420px;
    text-align: left;
    padding: 24px;
}

.report-date-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 20px;
    line-height: 1.3;
}

.report-date-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

.report-date-fields {
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
}

.report-date-field {
    flex: 1;
    min-width: 0;
}

.report-date-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.report-date-field input[type="date"] {
    width: 100%;
    max-width: 100%;
    color-scheme: dark;
}

.report-date-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.dashboard-page .dashboard-table-section .table-scroll {
    flex: 1;
    width: 100%;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

.dashboard-page .dashboard-table-section .data-table {
    width: 100%;
    table-layout: fixed;
}

.dashboard-page .dashboard-table-section .data-table td:nth-child(2) {
    word-break: break-word;
}

.dashboard-page .dashboard-table-section .data-table th:nth-child(1),
.dashboard-page .dashboard-table-section .data-table td:nth-child(1) {
    width: 14%;
}

.dashboard-page .dashboard-table-section .data-table th:nth-child(3),
.dashboard-page .dashboard-table-section .data-table td:nth-child(3) {
    width: 28%;
}

.dashboard-page .dashboard-table-section .data-table th:nth-child(4),
.dashboard-page .dashboard-table-section .data-table td:nth-child(4) {
    width: 18%;
}

.log-status-cell {
    word-break: break-word;
}

.log-status-badge {
    display: inline-block;
    margin-bottom: 6px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
}

.log-status-success {
    color: var(--success);
    background: var(--success-soft);
    border-color: var(--success-border);
}

.log-status-failed {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: var(--danger-border);
}

.log-status-test {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: var(--warning-border);
}

.log-status-queued {
    color: var(--info);
    background: var(--info-soft);
    border-color: var(--info-border);
}

.log-status-retry {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: var(--warning-border);
}

.log-status-detail {
    display: block;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}

.table-scroll .data-table {
    border: none;
    border-radius: 0;
}

.table-scroll .data-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-alt);
    z-index: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 22px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), border-color var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.stat-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.stat-value {
    display: block;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.modal-box-wide {
    max-width: 520px;
}

.send-progress-bar-wrap {
    width: 100%;
    height: 10px;
    border-radius: var(--radius-pill);
    margin-bottom: 12px;
    background: var(--surface-alt);
    overflow: hidden;
}

.send-progress-bar {
    height: 100%;
    width: 0;
    border-radius: var(--radius-pill);
    background: var(--primary);
    transition: width 0.25s ease;
}

.send-progress-text {
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-body);
}

.phone-upload-info {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.send-log {
    max-height: 280px;
    overflow-y: auto;
    padding: 4px 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}

.send-log-line {
    font-size: 13px;
    padding: 8px 0;
    color: var(--text-body);
    border-bottom: 1px solid var(--border);
}

.send-log-line:last-child {
    border-bottom: none;
}

.send-complete {
    font-size: 16px;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 20px;
}

.test-mode-status {
    margin-bottom: 28px;
}

.test-mode-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
}

.test-mode-badge.is-active {
    color: var(--warning);
    border-color: var(--warning-border);
    background: var(--warning-soft);
}

.test-mode-badge.is-inactive {
    color: var(--success);
    border-color: var(--success-border);
    background: var(--success-soft);
}

.test-mode-form {
    max-width: 560px;
}

.toggle-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-body);
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color var(--transition), background var(--transition);
}

.toggle-option:hover {
    border-color: var(--border-strong);
}

.toggle-option input {
    margin-top: 2px;
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.api-key-box code,
.api-key-cell code,
.api-doc code,
.api-doc pre {
    font-family: 'SF Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
    word-break: break-all;
}

.api-key-box {
    display: flex;
    align-items: center;
    background: var(--surface-alt);
}

.api-key-box code {
    display: block;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
}

.api-key-cell {
    max-width: 280px;
}

.api-key-cell code {
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
    color: var(--text-body);
}

.api-regenerate-form {
    display: inline-block;
}

.btn-edit-sm {
    padding: 4px 8px;
    font-size: 14px;
    line-height: 1;
}

.api-inline-form {
    margin-top: 16px;
}

.api-note {
    margin-top: 14px;
}

.api-doc p {
    margin-bottom: 10px;
}

.api-doc pre {
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.table-action-form {
    margin: 0;
}

.table-action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-body);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-edit:hover {
    background: var(--primary-soft);
    border-color: var(--primary-border);
    color: var(--primary-text);
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-body);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-delete:hover {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: var(--danger);
}

.phone-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.phone-input-row .form-input {
    flex: 1;
    min-width: 0;
}

.btn-import {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 46px;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-body);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-import:hover {
    background: var(--primary-soft);
    border-color: var(--primary-border);
    color: var(--primary-text);
}

.phone-count {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
}

.modal-overlay[hidden] {
    display: none;
}

.modal-box {
    width: 100%;
    max-width: 420px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 22px;
}

.modal-form .form-group:last-of-type {
    margin-bottom: 26px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-body);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    padding: 11px 20px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.form-cancel:hover {
    background: var(--surface-alt);
    border-color: var(--text-muted);
    color: var(--text);
}

input[type="number"].form-input {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"].form-input::-webkit-outer-spin-button,
input[type="number"].form-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sidebar-toggle {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 12px;
        right: auto;
        z-index: 1200;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--surface);
        color: var(--text);
        cursor: pointer;
        box-shadow: var(--shadow-sm);
        transition: left 0.25s ease, right 0.25s ease;
    }

    body.sidebar-open .sidebar-toggle {
        left: auto;
        right: 12px;
    }

    aside.sidebar .sidebar-header {
        padding-top: 20px;
        padding-left: 20px;
        padding-right: 56px;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1050;
        background: rgba(15, 23, 42, 0.45);
    }

    .sidebar-backdrop[hidden] {
        display: none;
    }

    .main-content {
        width: 100%;
        min-height: 100dvh;
        height: auto;
        padding: 68px 16px 24px;
        overflow: visible;
    }

    .page-header {
        margin-bottom: 24px;
        padding-bottom: 14px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .page-header p {
        font-size: 13px;
    }

    .alert {
        padding: 12px 14px;
        font-size: 13px;
        line-height: 1.6;
    }

    .sms-form,
    .info-box,
    .test-mode-form {
        max-width: none;
    }

    .form-submit,
    .form-cancel {
        width: 100%;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 24px;
    }

    .stat-value {
        font-size: 26px;
    }

    .panel-section {
        margin-bottom: 28px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        max-width: none;
        min-width: 560px;
    }

    .dashboard-page {
        overflow: visible;
        min-height: 100dvh;
        height: auto;
    }

    .dashboard-page .dashboard-layout {
        min-height: auto;
    }

    .dashboard-page .dashboard-table-section {
        min-height: 320px;
    }

    .dashboard-page .dashboard-table-section .table-scroll {
        min-height: 240px;
        max-height: 55dvh;
    }

    .dashboard-page .dashboard-table-section .data-table {
        min-width: 520px;
        table-layout: auto;
    }

    .table-action-buttons {
        flex-wrap: nowrap;
    }

    .phone-input-row {
        flex-wrap: nowrap;
    }

    .btn-import {
        width: 44px;
        min-width: 44px;
    }

    .modal-overlay {
        padding: 16px;
        align-items: center;
    }

    .modal-box,
    .modal-box-wide {
        max-width: none;
        max-height: 90dvh;
        overflow-y: auto;
        padding: 20px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .form-submit,
    .modal-actions .form-cancel {
        width: 100%;
    }

    .send-log {
        max-height: 45dvh;
    }

    .toggle-option {
        font-size: 13px;
    }
}

.sender-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: start;
}

.sender-channel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}

.sender-channel .sms-form {
    max-width: none;
}

.sender-channel-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.sender-channel-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: #ffffff;
}

.sender-channel-icon svg {
    width: 20px;
    height: 20px;
}

.channel-sms .sender-channel-icon {
    background: #2563eb;
}

.channel-whatsapp .sender-channel-icon {
    background: #25d366;
}

.channel-telegram .sender-channel-icon {
    background: #229ed9;
}

.sender-channel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.sender-channel-desc {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}

.send-progress-title {
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

@media (max-width: 1100px) {
    .sender-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 64px 12px 20px;
    }

    .page-header h1 {
        font-size: 18px;
    }

    .section-title {
        font-size: 15px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .stat-value {
        font-size: 24px;
    }
}
