/* ============================================================
   Agent Asystent Prezesa — style.css
   Dark professional theme, mobile-first
   ============================================================ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colors */
  --bg:           #0f1117;
  --surface:      #1a1d27;
  --surface2:     #22253a;
  --border:       #2d3040;
  --border2:      #3a3f55;
  --accent:       #5b8af0;
  --accent-hover: #3d6fd6;
  --accent-dim:   rgba(91,138,240,.15);

  --text:         #e2e8f0;
  --text2:        #8892a4;
  --text3:        #5a6478;

  --red:          #ef4444;
  --red-dim:      rgba(239,68,68,.15);
  --orange:       #f97316;
  --orange-dim:   rgba(249,115,22,.15);
  --yellow:       #eab308;
  --yellow-dim:   rgba(234,179,8,.15);
  --green:        #22c55e;
  --green-dim:    rgba(34,197,94,.15);
  --purple:       #a855f7;
  --purple-dim:   rgba(168,85,247,.15);
  --gray-dim:     rgba(136,146,164,.15);

  /* Sizes */
  --sidebar-w:    240px;
  --header-h:     60px;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 2px 8px rgba(0,0,0,.4);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.6);

  /* Typography */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "Courier New", monospace;
}

html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1,h2,h3,h4 { font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
h4 { font-size: .875rem; }

p { color: var(--text2); font-size: .9rem; }

ul { list-style: none; }

input, textarea, select {
  font-family: var(--font);
  font-size: .9rem;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { resize: vertical; min-height: 100px; }
select option { background: var(--surface2); }

label { display: block; font-size: .8rem; color: var(--text2); margin-bottom: .3rem; font-weight: 500; }

/* ── Layout ── */
#app { display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.25rem;
  gap: 1rem;
}
.header-logo {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1rem; color: var(--text);
  flex-shrink: 0;
}
.header-logo svg { color: var(--accent); }
.header-logo span.logo-sub { font-size: .7rem; font-weight: 400; color: var(--text2); }

.header-spacer { flex: 1; }

.status-badge {
  display: flex; align-items: center; gap: .4rem;
  font-size: .75rem; color: var(--text2);
  padding: .3rem .7rem; border-radius: 20px;
  background: var(--surface2); border: 1px solid var(--border);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  animation: pulse-green 2s infinite;
}
.status-dot.offline { background: var(--red); animation: none; }
.status-dot.warning { background: var(--yellow); animation: pulse-yellow 2s infinite; }

@keyframes pulse-green {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  50% { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}
@keyframes pulse-yellow {
  0%,100% { box-shadow: 0 0 0 0 rgba(234,179,8,.5); }
  50% { box-shadow: 0 0 0 4px rgba(234,179,8,0); }
}

.user-menu {
  display: flex; align-items: center; gap: .5rem; cursor: pointer;
  padding: .3rem .6rem; border-radius: var(--radius);
  transition: background .15s;
}
.user-menu:hover { background: var(--surface2); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 600;
}
.user-name { font-size: .85rem; font-weight: 500; }

.hamburger {
  display: none; cursor: pointer; padding: .4rem;
  border: none; background: none; color: var(--text);
}

/* Body layout */
#body { display: flex; margin-top: var(--header-h); flex: 1; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 90;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; transition: transform .25s ease;
}

.nav-section-label {
  font-size: .65rem; font-weight: 700; color: var(--text3);
  letter-spacing: .1em; text-transform: uppercase;
  padding: 1.2rem 1rem .4rem;
}

.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem; cursor: pointer;
  color: var(--text2); font-size: .875rem; font-weight: 500;
  border-radius: var(--radius); margin: 0 .5rem .1rem;
  transition: background .15s, color .15s;
  border: none; background: none; width: calc(100% - 1rem); text-align: left;
}
.nav-item svg { flex-shrink: 0; color: var(--text3); transition: color .15s; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item:hover svg { color: var(--accent); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item.active svg { color: var(--accent); }

.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: .65rem; font-weight: 700; padding: .1rem .4rem;
  border-radius: 10px; min-width: 18px; text-align: center;
}
.nav-badge.zero { display: none; }

.sidebar-footer {
  margin-top: auto; padding: 1rem;
  border-top: 1px solid var(--border);
  font-size: .75rem; color: var(--text3); text-align: center;
}

/* Main content */
#main {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: calc(100vh - var(--header-h));
  padding: 1.5rem; max-width: 1400px;
}

/* ── Section wrapper ── */
.section { display: none; }
.section.active { display: block; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem;
}
.section-title { font-size: 1.3rem; font-weight: 700; }
.section-subtitle { font-size: .8rem; color: var(--text2); margin-top: .15rem; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: .75rem; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: .75rem;
}
.card-value {
  font-size: 2rem; font-weight: 700; color: var(--text);
  line-height: 1;
}
.card-sub { font-size: .8rem; color: var(--text2); margin-top: .25rem; }

/* Grid layouts */
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 1rem; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: .72rem; font-weight: 700;
  color: var(--text3); text-transform: uppercase; letter-spacing: .06em;
  padding: .6rem 1rem; border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
th:first-child { border-radius: var(--radius-lg) 0 0 0; }
th:last-child { border-radius: 0 var(--radius-lg) 0 0; }
td {
  padding: .7rem 1rem; font-size: .875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.table-empty { text-align: center; color: var(--text3); padding: 2rem !important; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
  line-height: 1.4; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-icon { padding: .4rem; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover:not(:disabled) { background: #16a34a; }

.btn-ghost { background: transparent; color: var(--text2); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }

.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover:not(:disabled) { background: var(--accent-dim); }

.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Badges / Pills ── */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .15rem .55rem; border-radius: 20px;
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-urgent { background: var(--red-dim); color: var(--red); }
.badge-high { background: var(--orange-dim); color: var(--orange); }
.badge-medium { background: var(--yellow-dim); color: var(--yellow); }
.badge-low { background: var(--gray-dim); color: var(--text2); }
.badge-spam { background: rgba(30,30,30,.8); color: var(--text3); }
.badge-info { background: var(--accent-dim); color: var(--accent); }
.badge-success { background: var(--green-dim); color: var(--green); }
.badge-warning { background: var(--yellow-dim); color: var(--yellow); }
.badge-danger { background: var(--red-dim); color: var(--red); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-neutral { background: var(--gray-dim); color: var(--text2); }

/* ── Alerts / Banners ── */
.alert {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem; border-radius: var(--radius);
  font-size: .875rem; margin-bottom: 1rem;
}
.alert-info { background: var(--accent-dim); border: 1px solid rgba(91,138,240,.3); color: var(--accent); }
.alert-warning { background: var(--yellow-dim); border: 1px solid rgba(234,179,8,.3); color: var(--yellow); }
.alert-danger { background: var(--red-dim); border: 1px solid rgba(239,68,68,.3); color: var(--red); }
.alert-success { background: var(--green-dim); border: 1px solid rgba(34,197,94,.3); color: var(--green); }
.alert-icon { flex-shrink: 0; margin-top: .05rem; }

/* ── Dashboard ── */
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; gap: .4rem;
}
.stat-card .icon {
  width: 36px; height: 36px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; margin-bottom: .2rem;
}
.stat-card .icon.blue { background: var(--accent-dim); color: var(--accent); }
.stat-card .icon.red { background: var(--red-dim); color: var(--red); }
.stat-card .icon.green { background: var(--green-dim); color: var(--green); }
.stat-card .icon.yellow { background: var(--yellow-dim); color: var(--yellow); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.dash-grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }

/* ── Action list ── */
.action-list { display: flex; flex-direction: column; gap: .5rem; }
.action-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .75rem; background: var(--surface2); border-radius: var(--radius);
  border: 1px solid var(--border); cursor: pointer; transition: border-color .15s;
}
.action-item:hover { border-color: var(--accent); }
.action-item .priority-bar {
  width: 3px; border-radius: 3px; align-self: stretch; flex-shrink: 0;
}
.priority-bar.urgent { background: var(--red); }
.priority-bar.high { background: var(--orange); }
.priority-bar.medium { background: var(--yellow); }
.priority-bar.low { background: var(--text3); }
.action-item .ai { flex: 1; }
.action-item .ai h4 { font-size: .875rem; font-weight: 600; margin-bottom: .15rem; }
.action-item .ai p { font-size: .78rem; color: var(--text2); }
.action-item .meta { font-size: .7rem; color: var(--text3); margin-top: .15rem; }

/* ── Email List (Inbox) ── */
.inbox-layout { display: grid; grid-template-columns: 360px 1fr; gap: 0; min-height: 600px; }
.email-list-panel {
  border: 1px solid var(--border); border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column; background: var(--surface);
}
.email-detail-panel {
  border: 1px solid var(--border); border-left: none;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: var(--surface); overflow: hidden; display: flex; flex-direction: column;
}

.inbox-filters {
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
  display: flex; gap: .5rem; flex-wrap: wrap; background: var(--surface2);
}
.inbox-filters input[type=text] { flex: 1; min-width: 120px; padding: .4rem .7rem; }
.filter-select { width: auto; padding: .4rem .65rem; }

.email-list { flex: 1; overflow-y: auto; }
.email-item {
  padding: .85rem 1rem; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
  display: flex; flex-direction: column; gap: .3rem;
}
.email-item:hover { background: var(--surface2); }
.email-item.active { background: var(--accent-dim); border-left: 3px solid var(--accent); }
.email-item.unread .email-sender { font-weight: 700; color: var(--text); }
.email-sender { font-size: .85rem; font-weight: 500; color: var(--text2); }
.email-subject { font-size: .875rem; font-weight: 600; color: var(--text); }
.email-snippet { font-size: .78rem; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-meta { display: flex; align-items: center; justify-content: space-between; }
.email-time { font-size: .7rem; color: var(--text3); }
.email-badges { display: flex; gap: .25rem; }

.email-detail-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.email-detail-subject { font-size: 1.1rem; font-weight: 700; margin-bottom: .4rem; }
.email-detail-meta { font-size: .8rem; color: var(--text2); display: flex; gap: 1rem; flex-wrap: wrap; }
.email-detail-body {
  flex: 1; overflow-y: auto; padding: 1.25rem;
  font-size: .875rem; line-height: 1.7; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.email-ai-panel {
  border-top: 1px solid var(--border); padding: 1rem 1.25rem;
  background: var(--surface2); display: flex; flex-direction: column; gap: .75rem;
}
.ai-classification { display: flex; flex-wrap: wrap; gap: .4rem; }
.ai-summary { font-size: .8rem; color: var(--text2); font-style: italic; }
.tone-selector { display: flex; gap: .4rem; flex-wrap: wrap; }
.tone-btn {
  padding: .3rem .7rem; border-radius: 20px; font-size: .75rem; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border2); background: var(--surface);
  color: var(--text2); transition: all .15s;
}
.tone-btn:hover, .tone-btn.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

.empty-detail {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text3); gap: .5rem;
}
.empty-detail svg { opacity: .3; }
.empty-detail p { font-size: .875rem; }

/* ── Drafts ── */
.draft-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem;
}
.draft-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: .75rem; gap: .75rem;
}
.draft-info h3 { font-size: .95rem; margin-bottom: .25rem; }
.draft-info p { font-size: .78rem; }
.draft-body {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  font-size: .875rem; line-height: 1.7; color: var(--text);
  white-space: pre-wrap; margin-bottom: .75rem;
}
.draft-editor { margin-bottom: .75rem; }
.draft-editor textarea { font-family: var(--mono); font-size: .85rem; }
.draft-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.draft-meta-info { font-size: .75rem; color: var(--text3); }

/* ── Calendar ── */
.calendar-week {
  display: grid; grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface);
}
.cal-header { background: var(--surface2); border-bottom: 1px solid var(--border); }
.cal-day-header {
  padding: .6rem .5rem; text-align: center;
  font-size: .75rem; font-weight: 700; color: var(--text2);
  border-left: 1px solid var(--border);
}
.cal-day-header.today { color: var(--accent); }
.cal-time-col { width: 60px; }
.cal-hour {
  height: 50px; padding: .25rem .4rem;
  font-size: .65rem; color: var(--text3); text-align: right;
  border-bottom: 1px solid var(--border);
}
.cal-cell {
  border-left: 1px solid var(--border); border-bottom: 1px solid var(--border);
  height: 50px; position: relative;
}
.cal-event {
  position: absolute; left: 2px; right: 2px; top: 2px; bottom: 2px;
  background: var(--accent-dim); border-left: 3px solid var(--accent);
  border-radius: 4px; padding: .2rem .4rem;
  font-size: .7rem; color: var(--accent); overflow: hidden;
  cursor: pointer; transition: background .12s;
}
.cal-event:hover { background: rgba(91,138,240,.25); }
.cal-event.conflict { background: var(--red-dim); border-color: var(--red); color: var(--red); }

.event-list { display: flex; flex-direction: column; gap: .75rem; }
.event-item {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: .85rem 1rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.event-time { font-size: .8rem; font-weight: 700; color: var(--accent); width: 70px; flex-shrink: 0; }
.event-body { flex: 1; }
.event-title { font-size: .9rem; font-weight: 600; margin-bottom: .2rem; }
.event-details { font-size: .78rem; color: var(--text2); }

/* ── Reports ── */
.report-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }
.report-item {
  display: flex; align-items: center; gap: 1rem;
  padding: .85rem 1.25rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  cursor: pointer; transition: border-color .15s;
}
.report-item:hover { border-color: var(--accent); }
.report-date { font-size: .875rem; font-weight: 700; min-width: 90px; }
.report-stats { display: flex; gap: 1rem; flex: 1; }
.report-stat { font-size: .8rem; color: var(--text2); }
.report-stat span { color: var(--text); font-weight: 600; }

.report-detail { display: none; }
.report-detail.visible { display: block; }
.report-section { margin-bottom: 1.5rem; }
.report-section h3 { font-size: .875rem; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .75rem; }
.report-items { display: flex; flex-direction: column; gap: .4rem; }
.report-items li { font-size: .875rem; color: var(--text); padding-left: 1rem; position: relative; }
.report-items li::before { content: "•"; position: absolute; left: 0; color: var(--accent); }

/* ── Approvals ── */
.approval-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem;
}
.approval-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.approval-type { font-size: .7rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; }
.approval-title { font-size: 1rem; font-weight: 600; margin-top: .2rem; }
.approval-desc { font-size: .875rem; color: var(--text2); margin-bottom: 1rem; }
.approval-preview {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; font-size: .85rem;
  margin-bottom: 1rem; white-space: pre-wrap; color: var(--text); line-height: 1.6;
}
.approval-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.approval-note { flex: 1; min-width: 180px; }

/* ── Settings ── */
.settings-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }
.settings-tab {
  padding: .65rem 1.1rem; font-size: .875rem; font-weight: 500; cursor: pointer;
  border: none; background: none; color: var(--text2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; white-space: nowrap;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.settings-panel { display: none; }
.settings-panel.active { display: block; }

.form-group { margin-bottom: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.integration-status {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1rem; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: .5rem;
}
.int-name { font-size: .875rem; font-weight: 600; }
.int-status { font-size: .78rem; display: flex; align-items: center; gap: .4rem; }
.int-dot { width: 8px; height: 8px; border-radius: 50%; }
.int-dot.active { background: var(--green); }
.int-dot.inactive { background: var(--text3); }

.agent-mode-slider { display: flex; flex-direction: column; gap: .75rem; }
.slider-labels { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text2); }
input[type=range] {
  -webkit-appearance: none; appearance: none; height: 6px;
  background: var(--border2); border-radius: 3px; border: none;
  padding: 0; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--bg);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text2); cursor: pointer; padding: .25rem; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 1rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .5rem;
}

/* ── Toasts ── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300;
  display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 1rem; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: .875rem; font-weight: 500;
  min-width: 260px; max-width: 380px;
  animation: toast-in .25s ease;
  border: 1px solid transparent;
}
.toast.hiding { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(120%); opacity: 0; } }
.toast-success { background: #14532d; border-color: var(--green); color: var(--green); }
.toast-error { background: #450a0a; border-color: var(--red); color: var(--red); }
.toast-warning { background: #451a03; border-color: var(--orange); color: var(--orange); }
.toast-info { background: #172554; border-color: var(--accent); color: var(--accent); }
.toast-close { margin-left: auto; cursor: pointer; opacity: .6; background: none; border: none; color: inherit; }
.toast-close:hover { opacity: 1; }

/* ── Loading ── */
.spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--border2); border-top-color: var(--accent);
  animation: spin .7s linear infinite; display: inline-block;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem; gap: 1rem; }
.loading-center p { color: var(--text2); font-size: .875rem; }

/* SSE status indicator */
.sse-status {
  display: flex; align-items: center; gap: .4rem;
  font-size: .72rem; color: var(--text2);
}
.sse-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text3);
}
.sse-dot.connected { background: var(--green); animation: pulse-green 2s infinite; }
.sse-dot.connecting { background: var(--yellow); animation: pulse-yellow 1s infinite; }
.sse-dot.error { background: var(--red); }

/* ── Timeline (plan dnia) ── */
.timeline { display: flex; flex-direction: column; position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: ""; position: absolute; left: .5rem; top: .5rem; bottom: .5rem;
  width: 2px; background: var(--border2);
}
.timeline-item { position: relative; padding-bottom: 1rem; }
.timeline-dot {
  position: absolute; left: -1.15rem; top: .25rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
}
.timeline-dot.now { background: var(--green); animation: pulse-green 2s infinite; box-shadow: 0 0 0 4px var(--green-dim); }
.timeline-dot.past { background: var(--text3); }
.timeline-time { font-size: .72rem; color: var(--text2); margin-bottom: .1rem; }
.timeline-title { font-size: .875rem; font-weight: 600; }
.timeline-desc { font-size: .78rem; color: var(--text2); }

/* ── Risk items ── */
.risk-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .75rem; border-radius: var(--radius);
  background: var(--surface2); border: 1px solid var(--border);
  margin-bottom: .5rem;
}
.risk-icon { font-size: 1rem; flex-shrink: 0; }
.risk-body h4 { font-size: .85rem; font-weight: 600; }
.risk-body p { font-size: .78rem; color: var(--text2); }

/* ── AI Cost widget ── */
.cost-row { display: flex; justify-content: space-between; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.cost-row:last-child { border-bottom: none; }
.cost-model { font-size: .8rem; }
.cost-amount { font-size: .875rem; font-weight: 600; color: var(--accent); }

/* ── Misc ── */
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }
.text-muted { color: var(--text2); }
.text-small { font-size: .8rem; }
.text-center { text-align: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-gap { display: flex; align-items: center; gap: .5rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }

.no-data {
  text-align: center; padding: 3rem 1rem;
  color: var(--text3); font-size: .9rem;
}
.no-data svg { opacity: .2; margin-bottom: .75rem; }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Responsive / Mobile ── */
@media (max-width: 1200px) {
  .stat-cards { grid-template-columns: repeat(2,1fr); }
  .dash-grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 900px) {
  .inbox-layout { grid-template-columns: 1fr; }
  .email-detail-panel { display: none; }
  .email-detail-panel.mobile-open { display: flex; position: fixed; inset: var(--header-h) 0 0 0; z-index: 150; border-radius: 0; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid-3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  #main { margin-left: 0; padding: 1rem; }
  .hamburger { display: flex; }
  .stat-cards { grid-template-columns: repeat(2,1fr); }
  .calendar-week { overflow-x: auto; }
  .settings-tabs { flex-wrap: nowrap; }
}
@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .btn-group { flex-direction: column; }
  #toast-container { left: 1rem; right: 1rem; }
  .toast { min-width: unset; }
}
