/* ─────────────────────────────────────────────────────────
   WorkDash — Mobile-first Stylesheet
   ───────────────────────────────────────────────────────── */

:root {
  --bg:          #0f1117;
  --bg-card:     #1a1d27;
  --bg-nav:      #13151f;
  --bg-input:    #232634;
  --border:      #2d3148;
  --text:        #e2e4ef;
  --text-muted:  #7279a0;
  --accent:      #5b7cf6;
  --accent-hover:#4a68e0;
  --success:     #3cb87a;
  --danger:      #e05c5c;
  --warning:     #e0a020;
  --radius:      10px;
  --shadow:      0 2px 12px rgba(0,0,0,.35);
}

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

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

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

/* ─── NAVBAR ──────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 52px;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  margin-right: 8px;
}
.navbar-brand:hover { text-decoration: none; color: var(--accent); }

.navbar-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 5px 12px;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active {
  background: rgba(91,124,246,.15);
  color: var(--accent);
  text-decoration: none;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.user-badge {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  text-decoration: none;
}
.user-badge:hover { color: var(--text); text-decoration: none; }
.logout-link {
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.logout-link:hover {
  background: var(--bg-input);
  text-decoration: none;
}

.session-countdown {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 8px;
  white-space: nowrap;
  transition: color .3s, border-color .3s, background .3s;
}
.session-warning {
  color: #e0a020;
  border-color: rgba(224,160,32,.5);
  background: rgba(224,160,32,.1);
}
.session-critical {
  color: #e05c5c;
  border-color: rgba(224,92,92,.5);
  background: rgba(224,92,92,.1);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .6; }
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
}

/* Mobile menu */
.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
.mobile-menu.open { display: flex; }
.mobile-link {
  padding: 12px 20px;
  color: var(--text);
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.mobile-link:hover { background: var(--bg-input); text-decoration: none; }

/* ─── FLASH MESSAGES ──────────────────────────────────── */
.flash-container { padding: 12px 16px 0; }
.flash {
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 14px;
  transition: opacity .4s;
}
.flash-success { background: rgba(60,184,122,.18); border: 1px solid rgba(60,184,122,.4); color: #6feab0; }
.flash-error   { background: rgba(224,92,92,.18);  border: 1px solid rgba(224,92,92,.4);  color: #f09090; }
.flash-warning { background: rgba(224,160,32,.18); border: 1px solid rgba(224,160,32,.4); color: #f0c060; }

/* ─── MAIN CONTENT ────────────────────────────────────── */
.main-content {
  padding: 20px 16px 40px;
}

/* ─── PAGE HEADER ─────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.page-title { font-size: 20px; font-weight: 600; }
.page-date  { color: var(--text-muted); font-size: 14px; }

/* ─── DASHBOARD LAYOUT ────────────────────────────────── */
.dashboard-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.dashboard-main {
  flex: 1 1 0;
  min-width: 0;
}

/* ─── LIVE FEED SIDEBAR ───────────────────────────────── */
.feed-sidebar {
  flex: 0 0 clamp(280px, 18vw, 400px);
  width: clamp(280px, 18vw, 400px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.feed-sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.feed-sidebar-title {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}
.feed-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: .4;
  transition: background .4s, opacity .4s;
  flex-shrink: 0;
}
.feed-dot-new {
  background: var(--success);
  opacity: 1;
}
.feed-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
}
.feed-toggle-btn:hover { background: var(--bg-input); color: var(--text); }

.feed-sidebar-body {
  overflow-y: auto;
  flex: 1;
}
.feed-sidebar-list {
  display: flex;
  flex-direction: column;
}
.feed-loading, .feed-empty {
  padding: 20px 14px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.feed-sidebar-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(45,49,72,.5);
  transition: background .2s;
}
.feed-sidebar-item:last-child { border-bottom: none; }
.feed-sidebar-item:hover { background: var(--bg-input); }

@keyframes feedFlash {
  0%   { background: rgba(60,184,122,.18); }
  100% { background: transparent; }
}
.feed-item-new {
  animation: feedFlash 1.8s ease-out forwards;
}

.fsi-icon  { font-size: 17px; line-height: 1.3; flex-shrink: 0; }
.fsi-body  { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.fsi-text  { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fsi-meta  { font-size: 11px; color: var(--text-muted); }
.fsi-time  { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; padding-top: 2px; }
.fsi-del {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: .35;
  transition: opacity .15s, color .15s;
  flex-shrink: 0;
}
.fsi-del:hover { opacity: 1; color: var(--danger); }

/* ─── COLUMNS / CARDS ─────────────────────────────────── */
.columns {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.column {
  flex: 1 1 260px;
  min-width: 240px;
}

.column-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 4px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--card-color, var(--accent));
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.card-icon  { font-size: 20px; line-height: 1; }
.card-title { font-weight: 600; font-size: 15px; }
.card-desc  { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── BUTTONS ─────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:disabled { opacity: .65; cursor: default; }

.btn-run     { background: var(--accent); color: #fff; }
.btn-log     { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-done    { background: var(--success); color: #fff; }
.btn-pending { background: #2c5bcc; color: #fff; }
.btn-local   { background: #5c6e2c; color: #d4eaa0; border: 1px solid #7a9040; }

/* Generic primary */
.btn-primary {
  display: inline-block;
  padding: 9px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-full { width: 100%; text-align: center; }

/* Danger */
.btn-danger-sm {
  padding: 4px 10px;
  background: rgba(224,92,92,.2);
  border: 1px solid rgba(224,92,92,.4);
  color: #f09090;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
}
.btn-danger-sm:hover { background: rgba(224,92,92,.35); }

/* Toggle */
.btn-toggle {
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.btn-toggle:hover { background: var(--border); }

/* ─── LOGIN ───────────────────────────────────────────── */
.login-wrap {
  min-height: calc(100vh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-logo  { font-size: 40px; text-align: center; margin-bottom: 8px; }
.login-title { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-sub   { text-align: center; color: var(--text-muted); margin-bottom: 24px; }

/* ─── FORMS ───────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 160px;
}
.form-group label { font-size: 13px; color: var(--text-muted); }
.form-group-wide  { flex: 2 1 240px; }
.form-group-full  { flex: 1 1 100%; }
.form-group-check { justify-content: flex-end; padding-bottom: 4px; }

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--accent); }
.form-input-sm    { max-width: 100px; }
.form-input-color { padding: 2px 6px; height: 38px; cursor: pointer; }

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.select-inline { display: inline-block; width: auto; padding: 5px 10px; }

/* ─── PERIOD SELECTOR ─────────────────────────────────── */
.period-selector { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); }

/* ─── STATS ───────────────────────────────────────────── */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  flex: 1 1 280px;
  min-width: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.stats-card-wide { flex: 2 1 480px; }
.stats-card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.stats-loading { color: var(--text-muted); font-size: 14px; }
.stats-empty { color: var(--text-muted); font-size: 14px; }
.error-text { color: #f09090; }

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.stats-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.stats-table td { padding: 8px 10px; border-bottom: 1px solid rgba(45,49,72,.5); }
.stats-table tr:last-child td { border-bottom: none; }
.stats-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.table-scroll { overflow-x: auto; }

/* ─── ACTIVITY FEED ───────────────────────────────────── */
.feed { display: flex; flex-direction: column; gap: 6px; }
.feed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-input);
  border-radius: 8px;
  font-size: 13px;
}
.feed-icon  { font-size: 18px; flex-shrink: 0; }
.feed-body  { display: flex; flex-direction: column; flex: 1; gap: 2px; min-width: 0; }
.feed-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-meta  { color: var(--text-muted); font-size: 12px; }
.feed-time  { color: var(--text-muted); font-size: 12px; white-space: nowrap; flex-shrink: 0; }

/* ─── ADMIN ───────────────────────────────────────────── */
.admin-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.admin-section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 16px;
}
.admin-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.admin-table td { padding: 9px 10px; border-bottom: 1px solid rgba(45,49,72,.5); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.row-inactive { opacity: .5; }

.admin-add-form {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 12px;
}
.admin-add-form summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--accent);
  list-style: none;
  padding: 2px 0;
}
.admin-add-form summary::-webkit-details-marker { display: none; }
.admin-add-form[open] summary { margin-bottom: 16px; }

.inline-form { display: flex; flex-direction: column; gap: 0; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-todo   { background: rgba(60,184,122,.2);  color: #6feab0; }
.badge-script { background: rgba(91,124,246,.2);  color: #9ab4ff; }

/* Edit-Button (klein, inline) */
.btn-edit-sm {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(91,124,246,.15);
  border: 1px solid rgba(91,124,246,.35);
  color: #9ab4ff;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
}
.btn-edit-sm:hover { background: rgba(91,124,246,.28); text-decoration: none; }

/* Aktions-Zelle (mehrere Buttons nebeneinander) */
.td-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Edit-Seiten */
.edit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 760px;
  box-shadow: var(--shadow);
}
.edit-card-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.btn-cancel {
  color: var(--text-muted);
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  text-decoration: none;
}
.btn-cancel:hover { background: var(--bg-input); text-decoration: none; color: var(--text); }

/* ─── FORCED PASSWORD BANNER ──────────────────────────── */
.forced-banner {
  background: rgba(224,160,32,.15);
  border: 1px solid rgba(224,160,32,.4);
  color: #f0c060;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

/* ─── NOTE BAR ────────────────────────────────────────── */
.note-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}
.note-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.note-input:focus { border-color: var(--accent); }
.btn-note {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.btn-note-done { background: var(--success) !important; color: #fff !important; border-color: var(--success) !important; }

/* ─── MODAL ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: flex-end;
  z-index: 500;
  padding: 0;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  width: 100%;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0,0,0,.5);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}
.modal-close {
  background: none; border: none;
  color: var(--text-muted); font-size: 22px;
  cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.log-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Mono', 'Menlo', monospace;
  white-space: pre-wrap;
  word-break: break-all;
  color: #b8c0e0;
  background: #0d0f1a;
  margin: 0;
}

/* ─── CARD DELETE BUTTON ──────────────────────────────── */
.btn-card-del {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: .3;
  transition: opacity .15s, color .15s;
  flex-shrink: 0;
}
.btn-card-del:hover { opacity: 1; color: var(--danger); }

/* ─── ADD CARD BUTTON (bottom of column) ──────────────── */
.btn-add-card {
  display: block;
  width: 100%;
  padding: 8px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, color .15s, background .15s;
  margin-top: 4px;
}
.btn-add-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(91,124,246,.07);
}

/* ─── MODAL BODY (for forms, not log) ────────────────── */
.modal-body {
  padding: 20px 22px 8px;
  overflow-y: auto;
}

/* ─── EMPTY STATE ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; }

/* ─── UTILS ───────────────────────────────────────────── */
.text-muted { color: var(--text-muted); font-size: 13px; }

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 680px) {
  .navbar-links, .navbar-user { display: none; }
  .hamburger { display: block; }

  .dashboard-layout { flex-direction: column; }
  .feed-sidebar {
    flex: none;
    width: 100%;
    position: static;
    max-height: 320px;
  }

  .column { flex: 1 1 100%; max-width: 100%; }

  .modal-overlay { align-items: flex-end; }
  .modal { max-height: 80vh; border-radius: 14px 14px 0 0; }

  .stats-card { flex: 1 1 100%; }

  .admin-table th:nth-child(4),
  .admin-table td:nth-child(4) { display: none; }
}

@media (min-width: 681px) {
  .mobile-menu { display: none !important; }
  .modal-overlay { align-items: center; padding: 20px; }
  .modal {
    border-radius: 14px;
    width: 100%;
    max-width: 760px;
    margin: auto;
  }
}

@media (min-width: 900px) {
  .main-content { padding: 28px 32px 60px; }
}

@media (min-width: 1600px) {
  .main-content { padding: 28px 48px 60px; }
}
