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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
    line-height: 1.5;
}

/* ── Login ── */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: #fff; padding: 40px; border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,.08);
    width: 100%; max-width: 360px; text-align: center;
}
.login-box h1 { font-size: 28px; margin-bottom: 4px; }
.login-box p { color: #888; margin-bottom: 24px; font-size: 14px; }
.login-box input {
    display: block; width: 100%; padding: 12px; margin-bottom: 12px;
    border: 1px solid #ddd; border-radius: 8px; font-size: 15px;
}
.login-box button {
    width: 100%; padding: 12px; background: #1a1a1a; color: #fff;
    border: none; border-radius: 8px; font-size: 15px; cursor: pointer;
    font-weight: 500;
}
.login-box button:hover { background: #333; }
.error { background: #fee; color: #c00; padding: 10px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }

/* ── Dashboard ── */
.dashboard { max-width: 960px; margin: 0 auto; padding: 24px; }
header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px;
}
header h1 { font-size: 22px; font-weight: 600; }
header .user { font-size: 14px; color: #666; }
header .user a { color: #333; text-decoration: none; }
header .user a:hover { text-decoration: underline; }

/* ── Stats ── */
.stats-row { display: flex; gap: 16px; margin-bottom: 32px; }
.stat-card {
    background: #fff; padding: 20px; border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06); flex: 1; text-align: center;
}
.stat-num { font-size: 32px; font-weight: 700; color: #1a1a1a; }
.stat-label { font-size: 13px; color: #888; margin-top: 4px; }

/* ── Channels ── */
.channels-row { display: flex; gap: 16px; margin-bottom: 24px; }
.channel-card {
    background: #fff; padding: 16px; border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06); flex: 1; text-align: center;
}
.channel-card.offline { opacity: .5; }
.channel-card.paused { border-left: 3px solid #f90; }
.ch-icon { font-size: 24px; margin-bottom: 4px; }
.ch-name { font-weight: 500; font-size: 14px; text-transform: capitalize; }
.ch-stats { font-size: 12px; color: #888; margin-top: 6px; }
.ch-time { font-size: 11px; color: #aaa; margin-top: 2px; }

/* ── Badges ── */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 6px;
    font-size: 11px; font-weight: 500; text-transform: uppercase;
}
.badge.online, .badge.active, .badge.calculated, .badge.ordered { background: #e6f7e6; color: #1a7a1a; }
.badge.offline { background: #f5f5f5; color: #999; }
.badge.paused { background: #fff3e0; color: #e67e00; }
.badge.rejected { background: #fde8e8; color: #c00; }
.badge.sent { background: #e3f0ff; color: #2563eb; }

/* ── Table ── */
h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: #333; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
thead { background: #fafafa; }
th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: .5px; }
td { padding: 10px 16px; font-size: 14px; border-top: 1px solid #f0f0f0; }
td a { color: #333; text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }
tbody tr:hover { background: #fafafa; }

/* ── Toggle ── */
.toggle-btn {
    padding: 6px 14px; border: none; border-radius: 6px; font-size: 12px;
    font-weight: 500; cursor: pointer; width: 100%; transition: background .2s;
}
.toggle-btn.on { background: #fde8e8; color: #c00; }
.toggle-btn.on:hover { background: #fcc; }
.toggle-btn.off { background: #e6f7e6; color: #1a7a1a; }
.toggle-btn.off:hover { background: #c8f0c8; }

.client-block { margin-bottom: 32px; }
.client-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.client-header h2 { margin-bottom: 0; }

/* ── Message feed ── */
.msg-feed { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); padding: 12px 0; }
.msg-row { padding: 8px 16px; border-bottom: 1px solid #f5f5f5; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.msg-row:last-child { border-bottom: none; }
.msg-row.in { background: #fafafa; }
.msg-time { color: #aaa; font-size: 11px; min-width: 60px; padding-top: 1px; }
.msg-dir { font-weight: 700; font-size: 14px; min-width: 16px; }
.msg-row.out .msg-dir { color: #2563eb; }
.msg-row.in .msg-dir { color: #888; }
.msg-text { line-height: 1.4; word-break: break-word; }
.channel-card.active { border: 2px solid #333; }

/* ── Tabs ── */
.status-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 6px 14px; border-radius: 8px; font-size: 13px; text-decoration: none; color: #666; background: #f0f0f0; }
.tab.active { background: #1a1a1a; color: #fff; }
.tab:hover:not(.active) { background: #e0e0e0; }

/* ── Master Admin ── */
.client-card { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); padding: 20px; margin-bottom: 16px; }
.client-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.client-card-header h2 { margin: 0; font-size: 16px; }
.client-card-header h2 a { color: #1a1a1a; }
.client-links { margin-left: auto; font-size: 13px; display: flex; gap: 12px; }
.client-links a { color: #666; text-decoration: none; }
.client-links a:hover { color: #1a1a1a; }
.channels-mini { display: flex; gap: 12px; margin-bottom: 10px; }
.ch-mini { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 6px; background: #f5f5f5; }
.ch-mini.offline { opacity: .5; }
.ch-mini.paused { background: #fff3e0; }
.ch-mini-stats { font-size: 11px; color: #aaa; }
.client-stats-row { font-size: 13px; color: #888; display: flex; gap: 16px; }
.client-stats-row strong { color: #1a1a1a; }
