:root {
  --bg: #0a0a0a;
  --bg-elevated: #151517;
  --bg-card: #1c1c1f;
  --border: #2c2c30;
  --silver: #c4c8cf;
  --silver-dim: #8b8f96;
  --blue: #3d7bff;
  --blue-dim: #274a99;
  --rose: #e0789f;
  --rose-dim: #8f4d63;
  --text: #f2f2f2;
  --text-dim: #9a9aa0;
  --danger: #e0554f;
  --success: #4bbf7a;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

[hidden] {
  display: none !important;
}

/* ---------- Login ---------- */

#login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 24px;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
}

.login-subtitle {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  margin-top: 6px;
}

#login-form {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
  display: block;
}

input,
textarea,
select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--blue);
}

button {
  font-family: inherit;
  cursor: pointer;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
}

.btn-primary:active {
  background: var(--blue-dim);
}

.btn-secondary {
  background: transparent;
  color: var(--silver);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

/* ---------- App Shell ---------- */

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header-left img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.app-header-left span {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header-user {
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logout-link {
  color: var(--silver-dim);
  text-decoration: underline;
  font-size: 13px;
  background: none;
  border: none;
  padding: 0;
}

main {
  flex: 1;
  padding: 16px 16px 90px 16px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 4px 0 16px 0;
}

/* ---------- Bottom Nav ---------- */

nav.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 10;
}

nav.tabbar button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 10.5px;
  padding: 8px 2px 10px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}

nav.tabbar button.active {
  color: var(--blue);
}

nav.tabbar .tab-icon {
  font-size: 18px;
  line-height: 1;
}

.badge-dot {
  position: absolute;
  top: 2px;
  right: 18%;
  min-width: 15px;
  height: 15px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ---------- Cards ---------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.card-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.card-meta {
  font-size: 12.5px;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.card-content {
  font-size: 14px;
  color: var(--silver);
  white-space: pre-wrap;
  margin-top: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.tag.assign-alina {
  color: var(--rose);
  border-color: var(--rose-dim);
}

.tag.assign-denis {
  color: var(--blue);
  border-color: var(--blue-dim);
}

.tag.assign-beide {
  color: var(--success);
}

.tag.overdue {
  color: var(--danger);
  border-color: var(--danger);
}

.todo-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.todo-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--silver-dim);
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
}

.todo-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  color: #0a0a0a;
  font-weight: 700;
}

.todo-body {
  flex: 1;
  min-width: 0;
}

.todo-title.done {
  text-decoration: line-through;
  color: var(--text-dim);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  padding: 4px 6px;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

.empty-state {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  padding: 40px 16px;
}

/* ---------- Floating Add Button ---------- */

.fab {
  position: fixed;
  right: 18px;
  bottom: 78px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 26px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(61, 123, 255, 0.4);
  z-index: 9;
}

/* ---------- Modal / Form Sheet ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  z-index: 20;
}

.sheet {
  background: var(--bg-elevated);
  width: 100%;
  border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0));
  max-height: 88vh;
  overflow-y: auto;
}

.sheet-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

.sheet form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assign-toggle {
  display: flex;
  gap: 8px;
}

.assign-toggle button {
  flex: 1;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 13px;
}

.assign-toggle button.selected[data-value="alina"] {
  border-color: var(--rose);
  color: var(--rose);
  background: rgba(224, 120, 159, 0.12);
}

.assign-toggle button.selected[data-value="denis"] {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(61, 123, 255, 0.1);
}

.assign-toggle button.selected[data-value="beide"] {
  border-color: var(--success);
  color: var(--success);
  background: rgba(75, 191, 122, 0.12);
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.sheet-actions .btn-secondary {
  flex: 1;
}

.sheet-actions .btn-primary {
  flex: 2;
}

/* ---------- Wochenansicht Termine ---------- */

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.week-nav .icon-btn {
  font-size: 20px;
  padding: 4px 12px;
}

.week-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--silver);
}

.week-today-btn {
  display: block;
  width: 100%;
  margin-bottom: 14px;
}

.week-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px 12px;
}

.day-block.today {
  border-color: var(--blue-dim);
}

.day-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.day-name {
  font-weight: 700;
  font-size: 13.5px;
}

.day-block.today .day-name {
  color: var(--blue);
}

.day-date {
  font-size: 12px;
  color: var(--text-dim);
}

.day-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 2px 0;
}

.termin-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
}

.termin-card:last-child {
  margin-bottom: 0;
}

.termin-card .card-title {
  font-size: 14px;
  margin-bottom: 2px;
}

.termin-card .card-actions {
  margin-top: 2px;
}

/* ---------- Morning Summary ---------- */

.summary-banner {
  background: linear-gradient(135deg, rgba(61, 123, 255, 0.15), rgba(196, 200, 207, 0.06));
  border: 1px solid var(--blue-dim);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 13.5px;
  line-height: 1.5;
}

.summary-banner strong {
  color: var(--blue);
}
