.hidden {
  display: none !important;
}

:root {
  --green: #4CAF50;
  --yellow: #FFC107;
  --red: #f44336;
  --blue: #2196F3;
  --gray: #9e9e9e;
  --bg: #1e1e1e;
  --sidebar-bg: #242424;
  --card-bg: #2b2b2b;
  --summary-bg: #333333;
  --divider: #4a4a4a;
  --nav-active: #4d4d4d;
  --nav-hover: #3a3a3a;
  --text: #e8e8e8;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  display: flex;
  height: 100vh;
}

/* Sidebar */

.sidebar {
  width: 190px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 25px 12px;
}

.logo-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.logo-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.logo-text {
  font-size: 17px;
  font-weight: bold;
  margin-top: 6px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.nav-btn:hover {
  background: var(--nav-hover);
}

.nav-btn.active {
  background: var(--nav-active);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.welcome-name {
  font-size: 12px;
  color: var(--gray);
  padding: 0 4px;
}

/* Login screen */

.login-screen {
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  width: 320px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
}

.login-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 18px;
}

.login-box .form-field {
  text-align: left;
}

.login-notice {
  background: #4a2020;
  color: #ff8a80;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 14px;
}

/* Content */

.content {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

/* Dashboard-style screens scroll as a whole page and have their own padding.
   Split-layout screens (Resources/Projects/Time Tracker) fill .content
   edge-to-edge instead, matching customtkinter's un-padded panel layout. */
.page-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 20px 24px;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.content-header h1 {
  font-size: 24px;
  margin: 0;
}

.content-header .date {
  font-size: 13px;
  color: var(--gray);
}

/* Summary bar */

.summary-bar {
  background: var(--summary-bg);
  border-radius: 10px;
  display: flex;
  padding: 14px 0;
  margin-bottom: 8px;
}

.summary-col {
  flex: 1;
  text-align: center;
}

.summary-col .value {
  font-size: 22px;
  font-weight: bold;
  display: block;
}

.summary-col .label {
  font-size: 11px;
  color: var(--gray);
}

/* Section label */

.section-label {
  font-size: 15px;
  font-weight: bold;
  margin: 12px 0 4px;
}

/* Card grid */

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 0 20px;
}

.empty-message {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--gray);
  padding: 40px 0;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px 16px;
}

.card-top {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.card-top .dot {
  font-size: 13px;
  margin-right: 6px;
}

.card-top .name {
  font-size: 14px;
  font-weight: bold;
  flex: 1;
}

.card-top .status {
  font-size: 11px;
}

.card-sub {
  font-size: 11px;
  color: var(--gray);
  margin-bottom: 8px;
}

.card-divider {
  height: 1px;
  background: var(--divider);
  margin: 8px 0;
}

.card-metrics {
  display: flex;
  margin-bottom: 6px;
}

.card-metrics .metric {
  flex: 1;
  text-align: center;
}

.card-metrics .metric .value {
  font-size: 13px;
  font-weight: bold;
  display: block;
}

.card-metrics .metric .label {
  font-size: 10px;
  color: var(--gray);
}

.progress-track {
  height: 6px;
  background: #444;
  border-radius: 3px;
  margin: 4px 0 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
}

.card-buttons {
  display: flex;
  gap: 6px;
}

.card-buttons button {
  height: 30px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  padding: 0 12px;
}

.btn-primary {
  background: #1f6aa5;
  color: white;
  border: none;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--divider);
}

.tab-btn.active {
  background: var(--nav-active);
  border-color: var(--nav-active);
}

/* Placeholder view */

.placeholder {
  text-align: center;
  color: var(--gray);
  padding: 80px 20px;
  font-size: 14px;
}

/* Toast */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Error banner */

.error-banner {
  background: #4a2020;
  color: #ff8a80;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  font-size: 13px;
}

/* Split layout: list pane + form/detail pane (Resources, Projects, Time Tracker) */

.split-layout {
  display: flex;
  height: 100%;
}

.panel-list {
  flex-shrink: 0;
  background: var(--sidebar-bg);
  overflow-y: auto;
  padding: 15px;
}

.panel-form {
  flex: 1;
  overflow-y: auto;
  padding: 30px 40px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.panel-header h2 {
  font-size: 17px;
  margin: 0;
}

.list-item {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.list-item .info .name {
  font-size: 13px;
  font-weight: bold;
}

.list-item .info .sub {
  font-size: 11px;
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item .status-dot {
  font-size: 10px;
  flex-shrink: 0;
}

/* Forms */

.form-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 18px;
}

.form-field {
  margin-bottom: 12px;
}

.form-field label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.form-field .hint {
  font-size: 11px;
  color: var(--gray);
  margin-top: 2px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  max-width: 400px;
  background: #2f2f2f;
  border: 1px solid var(--divider);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
  font-family: inherit;
}

.form-textarea {
  min-height: 55px;
  resize: vertical;
}

.checkbox-list {
  background: var(--summary-bg);
  border-radius: 8px;
  padding: 8px 14px;
  max-width: 400px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

button.btn-danger {
  background: #c0392b;
  color: white;
  border: none;
  border-radius: 6px;
  height: 40px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 13px;
}

button.btn-small {
  height: 26px;
  padding: 0 10px;
  font-size: 11px;
  border-radius: 5px;
  cursor: pointer;
}

.form-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 8px;
}

.form-status {
  font-size: 12px;
  margin-top: 8px;
}

.empty-list {
  text-align: center;
  color: var(--gray);
  padding: 20px 0;
  font-size: 13px;
}

/* Data tables (Time Tracker, Revenue) */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table thead th {
  background: #444;
  text-align: left;
  padding: 8px 8px;
  font-weight: bold;
}

.data-table tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid #333;
}

.data-table .btn-icon {
  background: transparent;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 13px;
}

/* Inline form row (Time Tracker header form, Revenue log form) */

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--summary-bg);
  border-radius: 10px;
  padding: 14px 16px;
}

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

.inline-form label {
  font-size: 11px;
  color: var(--gray);
}

.inline-form input, .inline-form select {
  background: #2f2f2f;
  border: 1px solid var(--divider);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

button.btn-save {
  background: #1f6aa5;
  color: white;
  border: none;
  border-radius: 6px;
  height: 36px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 13px;
}

/* Two-column body (Revenue: by-project + recent log) */

.two-col {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0;
}

.two-col > .col {
  overflow-y: auto;
}

.two-col > .col:first-child {
  flex: 3;
}

.two-col > .col:last-child {
  flex: 2;
}

/* Revenue page: fixed header/summary/form, scrollable two-col body below */

.revenue-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 24px;
}

/* Analytics: list-row action buttons */

.list-item .buttons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Analytics: delete-confirmation box (in .panel-form) */

.delete-confirm-box {
  max-width: 400px;
}

.delete-confirm-box .warn {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
}

button.btn-danger:disabled {
  background: #5a3230;
  color: #b08a88;
  cursor: not-allowed;
}

/* Analytics: two-pane chat + feed layout */

.analytics-chat-page {
  display: flex;
  height: 100%;
}

.analytics-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
}

.analytics-chat-header h2 {
  font-size: 17px;
  margin: 0;
}

.analytics-chat-header .desc {
  font-size: 12px;
  color: var(--gray);
}

.analytics-feed-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.analytics-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

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

.analytics-feed-item .question {
  font-size: 11px;
  color: var(--gray);
  margin-bottom: 6px;
}

.analytics-feed-item .answer {
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.analytics-feed-item.error .answer {
  color: #ff8a80;
}

.chart-card {
  margin-top: 12px;
}

.chart-canvas-wrap {
  position: relative;
  height: 280px;
}

/* Analytics: chat sidebar */

.chat-sidebar {
  width: 340px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--divider);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-message {
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  max-width: 90%;
}

.chat-message.user {
  background: #1f6aa5;
  align-self: flex-end;
}

.chat-message.assistant {
  background: var(--card-bg);
  align-self: flex-start;
}

.chat-message.error {
  background: #4a2020;
  color: #ff8a80;
  align-self: flex-start;
}

.chat-loading {
  font-size: 12px;
  color: var(--gray);
  padding: 0 14px 8px;
  font-style: italic;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--divider);
}

.chat-input-row textarea {
  flex: 1;
  resize: none;
  height: 44px;
  background: #2f2f2f;
  border: 1px solid var(--divider);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}
