*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg:         #0d0d0f;
  --surface:    #16161a;
  --surface2:   #1e1e24;
  --border:     #2a2a32;
  --text:       #e0e0e8;
  --text-muted: #6b6b7e;
  --text-dim:   #9a9aaa;
  --accent:     #5c7cfa;
  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  --green:  #2ecc71;
  --red:    #e74c3c;
  --yellow: #f1c40f;
  --blue:   #3498db;
  --gray:   #4a4a5a;
}

html { height: 100%; }
body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Header ──────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

header h1 {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
}

.header-spacer { flex: 1; }

.user-info {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.logout-btn {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s;
}
.logout-btn:hover { color: var(--text); border-color: var(--text-dim); }

.lang-toggle {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.lang-toggle:hover { color: var(--text); border-color: var(--text-dim); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a46; }

/* ── Main layout ─────────────────────────────────────── */
.hub-main {
  flex: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 24px 60px;
  width: 100%;
}

.hub-date-row {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  gap: 12px;
}

.hub-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  flex: 1;
}

.btn-logtime-global {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.btn-logtime-global:hover { color: var(--accent); border-color: var(--accent); }

.hub-main-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.hub-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
  align-items: start;
}

.hub-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Widget shell ─────────────────────────────────────── */
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.widget-header {
  display: flex;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

/* Day tabs inside the calendar widget header */
.day-tabs {
  display: flex;
  gap: 4px;
  margin-left: 10px;
}

.day-tab {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.day-tab:hover { color: var(--text); border-color: var(--text-dim); }
.day-tab.active {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}

.widget-date {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.7;
  white-space: nowrap;
}

.widget-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.widget-body { padding: 4px 0; }
.widget-body--flush { padding: 0; }

/* ── Loading / empty / error states ─────────────────────── */
.widget-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 44px 0;
}
.widget-loading span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: dot-bounce 1.2s ease-in-out infinite;
}
.widget-loading span:nth-child(1) { animation-delay: 0s; }
.widget-loading span:nth-child(2) { animation-delay: 0.2s; }
.widget-loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.3; }
  30%            { transform: translateY(-7px); opacity: 1;   }
}

.widget-empty {
  padding: 40px 16px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

.widget-error {
  padding: 24px 16px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--red);
  opacity: 0.75;
}

.widget-reauth {
  padding: 20px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}
.widget-reauth a {
  color: var(--accent);
  text-decoration: none;
}
.widget-reauth a:hover { text-decoration: underline; }

/* ── Calendar events ─────────────────────────────────── */
.event-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 9px 16px;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
  border-radius: 0;
}
.event-item:hover { background: var(--surface2); }

.event-item + .event-item {
  border-top: 1px solid rgba(42,42,50,0.6);
}

/* All-day events */
.event-allday {
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  background: rgba(92,124,250,.04);
  border-left: 2px solid rgba(92,124,250,.3) !important;
}
.event-allday + .event-allday { border-top: 1px solid rgba(42,42,50,0.4); }

.event-allday-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(92,124,250,.1);
  border: 1px solid rgba(92,124,250,.22);
  border-radius: 2px;
  padding: 1px 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.event-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 78px;
  padding-top: 2px;
  gap: 1px;
}
.event-time-start { color: var(--text-dim); font-weight: 500; }
.event-time-end   { opacity: 0.55; font-size: 10px; }

.event-details {
  flex: 1;
  min-width: 0;
}

.event-subject {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.event-item:hover .event-subject { color: var(--text); }

.event-location {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-organizer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.7;
}

.event-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Now indicator ───────────────────────────────────── */
.event-now {
  border-left: 2px solid var(--green) !important;
  background: rgba(46,204,113,.03);
}
.event-now .event-time-start { color: var(--green); }

/* ── Module cards ─────────────────────────────────────── */
.module-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border);
}
.module-card:last-child { border-bottom: none; }
.module-card:hover { background: var(--surface2); }
.module-card:hover .module-arrow { color: var(--text); transform: translateX(3px); }

.module-icon {
  font-size: 20px;
  color: var(--accent);
  flex-shrink: 0;
  width: 26px;
  text-align: center;
  opacity: 0.85;
}

.module-info { flex: 1; min-width: 0; }

.module-name {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.module-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.module-arrow {
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.12s, transform 0.12s;
}

/* ── Footer & quick links ─────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 14px 24px;
  flex-shrink: 0;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Quick links — intentionally unobtrusive */
.quick-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  flex: 1;
}

.quick-links:empty { display: none; }

.quick-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
  white-space: nowrap;
}
.quick-link:hover { opacity: 1; color: var(--text-dim); }

/* Separator dot between links */
.quick-link + .quick-link::before {
  content: '·';
  margin: 0 8px;
  color: var(--border);
  opacity: 1;
}

.footer-copy {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.45;
  white-space: nowrap;
  margin-left: auto;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 800px) {
  .hub-grid {
    grid-template-columns: 1fr;
  }
  .hub-main { padding: 24px 16px 48px; }
}

@media (max-width: 480px) {
  header { padding: 0 14px; }
  .user-info { display: none; }
  .hub-main  { padding: 16px 12px 40px; }
  .event-time { width: 66px; }
  footer { padding: 12px 14px; }
  .footer-copy { display: none; } /* copyright wraps ugly on tiny screens, links are enough */
}

/* ── Small widget header icon buttons ───────────────────── */
.widget-icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.12s;
  margin-left: auto;
}
.widget-icon-btn:hover { color: var(--text); }

/* ── Redmine settings panel ──────────────────────────────── */
.rm-settings-panel {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.rm-settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rm-settings-row .form-label {
  flex-shrink: 0;
  margin: 0;
}

.rm-settings-row .form-select {
  flex: 1;
}

.rm-project-tag {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  background: rgba(92,124,250,.12);
  border: 1px solid rgba(92,124,250,.25);
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* ── Tracker bar ─────────────────────────────────────────── */
.tracker-bar {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  background: rgba(46, 204, 113, .04);
  border-bottom: 1px solid rgba(46, 204, 113, .14);
  min-width: 0;
}

.tracker-view {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.tracker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.tracker-dot.running { animation: tracker-pulse 1.5s ease-in-out infinite; }
.tracker-dot.paused  { background: var(--yellow); }
@keyframes tracker-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

.tracker-issue-label {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tracker-issue-label .tid { color: var(--accent); margin-right: 4px; }

.tracker-time {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  flex-shrink: 0;
  min-width: 56px;
  text-align: right;
  letter-spacing: 0.03em;
}
.tracker-time.paused { color: var(--yellow); }

.tracker-ctrl-btn {
  background: none;
  border: none;
  padding: 2px 5px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--mono);
  border-radius: 3px;
  transition: color 0.12s, background 0.12s;
  flex-shrink: 0;
  line-height: 1.4;
}
.tracker-ctrl-btn:hover          { color: var(--text); background: var(--surface2); }
.tracker-ctrl-btn.tracker-stop:hover { color: var(--red); }
.tracker-ctrl-btn.tracker-log   { color: var(--accent); }
.tracker-ctrl-btn.tracker-log:hover { color: var(--text); background: rgba(92,124,250,.12); }

.tracker-done-msg {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Issue rows ──────────────────────────────────────────── */
.issue-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  min-width: 0;
  transition: background 0.1s;
}
.issue-row:first-child { border-top: none; }
.issue-row:hover { background: rgba(255,255,255,.015); }

.issue-id-link {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}
.issue-id-link:hover { text-decoration: underline; }

.issue-info {
  flex: 1;
  min-width: 0;
}

.issue-subject {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.issue-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.issue-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.issue-status-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  white-space: nowrap;
  line-height: 1.5;
}
.issue-status-badge:hover { color: var(--text); border-color: var(--text-dim); }

.issue-action-btn {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  white-space: nowrap;
  line-height: 1.5;
}
.issue-action-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface2);
}
.issue-menu-btn { font-size: 14px; padding: 0 5px; letter-spacing: 0; }

.issue-action-btn.tracking {
  color: var(--green);
  border-color: rgba(46,204,113,.25);
}
.issue-action-btn.tracking:hover { color: var(--green); background: rgba(46,204,113,.06); }

/* ── Issues pagination ───────────────────────────────────── */
.issues-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 7px 16px;
  border-top: 1px solid var(--border);
}

.page-btn {
  font-family: var(--mono);
  font-size: 15px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 9px;
  line-height: 1.8;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.page-btn:hover:not(:disabled) { color: var(--text); border-color: var(--text-dim); }
.page-btn:disabled { opacity: 0.3; cursor: default; }

.page-info {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  min-width: 44px;
  text-align: center;
}

/* ── Issue dropdown (status / assign) ───────────────────── */
.issue-dropdown {
  position: fixed;
  z-index: 200;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,.55);
  min-width: 170px;
  max-height: 260px;
  overflow-y: auto;
}

.issue-dropdown-header {
  padding: 6px 12px 5px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface2);
}

.issue-dropdown-item {
  display: block;
  width: 100%;
  padding: 7px 12px;
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}
.issue-dropdown-item:hover  { background: rgba(92,124,250,.1); color: var(--text); }
.issue-dropdown-item.active { color: var(--accent); }

/* ── Log time modal ──────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.log-time-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  width: 380px;
  max-width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}

.modal-header {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex: 1;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.12s;
}
.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  transition: border-color 0.12s;
  outline: none;
  width: 100%;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 52px; }
.form-select option { background: var(--surface2); color: var(--text); }

.form-error {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--red);
  padding: 6px 0 0;
}

.modal-footer {
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-secondary {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-dim); }

.btn-primary {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 16px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn-primary:hover    { background: #4a6ce8; border-color: #4a6ce8; }
.btn-primary:disabled { opacity: 0.45; cursor: default; }
