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

:root {
  --bg: #0F1923;
  --bg-secondary: #1B2A4A;
  --card: #2C3E6B;
  --card-hover: #354873;
  --accent: #27AE60;
  --accent-hover: #219a52;
  --danger: #E74C3C;
  --warning: #F39C12;
  --info: #2980B9;
  --text: #FFFFFF;
  --text-muted: #8899AA;
  --border: #3A4F7A;
  --sidebar-width: 240px;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Login */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-box {
  background: var(--card);
  padding: 40px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 380px;
}

.login-box h1 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 24px;
}

.login-box p {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

.login-box .error {
  background: rgba(231,76,60,0.15);
  color: var(--danger);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  display: none;
}

/* Layout */
.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  padding: 20px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-logo h2 {
  font-size: 18px;
  color: var(--accent);
}

.sidebar-logo span {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar nav { flex: 1; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.sidebar nav a:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.sidebar nav a.active { background: rgba(39,174,96,0.15); color: var(--accent); border-right: 3px solid var(--accent); }
.sidebar nav a .icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.sidebar-footer .avatar {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

.sidebar-footer .logout {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
}

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

/* Main */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px 32px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 22px; font-weight: 600; }

/* KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.kpi-card .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-card .value {
  font-size: 28px;
  font-weight: 700;
}

.kpi-card .value.green { color: var(--accent); }
.kpi-card .value.blue { color: var(--info); }
.kpi-card .value.red { color: var(--danger); }
.kpi-card .value.yellow { color: var(--warning); }

/* Cards / Tables */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

tr:hover { background: rgba(255,255,255,0.02); }

/* Status badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-draft { background: rgba(136,153,170,0.2); color: var(--text-muted); }
.badge-ready { background: rgba(41,128,185,0.2); color: var(--info); }
.badge-sending { background: rgba(243,156,18,0.2); color: var(--warning); }
.badge-completed { background: rgba(39,174,96,0.2); color: var(--accent); }
.badge-paused { background: rgba(243,156,18,0.2); color: var(--warning); }
.badge-failed { background: rgba(231,76,60,0.2); color: var(--danger); }
.badge-APPROVED { background: rgba(39,174,96,0.2); color: var(--accent); }
.badge-PENDING { background: rgba(243,156,18,0.2); color: var(--warning); }
.badge-REJECTED { background: rgba(231,76,60,0.2); color: var(--danger); }

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #4a5f8a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); }

label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 12px;
}

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

/* File upload */
.file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.file-upload:hover { border-color: var(--accent); background: rgba(39,174,96,0.05); }
.file-upload.active { border-color: var(--accent); background: rgba(39,174,96,0.1); }
.file-upload p { color: var(--text-muted); font-size: 14px; }
.file-upload .icon { font-size: 36px; margin-bottom: 12px; }

/* Inbox */
.inbox-list { max-height: 600px; overflow-y: auto; }

.inbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: all 0.2s;
}

.inbox-item:hover { background: rgba(255,255,255,0.03); }
.inbox-item .phone { font-weight: 500; }
.inbox-item .preview { font-size: 13px; color: var(--text-muted); flex: 1; }
.inbox-item .time { font-size: 12px; color: var(--text-muted); }
.inbox-item .unread { background: var(--accent); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 10px; }

/* Messages thread */
.messages-thread { max-height: 500px; overflow-y: auto; padding: 16px; }

.message {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-size: 14px;
}

.message.incoming {
  background: var(--card);
  border-bottom-left-radius: 4px;
}

.message.outgoing {
  background: var(--accent);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.message .time { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 4px; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h2 { font-size: 18px; margin-bottom: 16px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  animation: slideIn 0.3s ease;
}

.toast-success { background: var(--accent); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }

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

/* Loading */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.loading-center { display: flex; justify-content: center; padding: 40px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 14px; }
