/**
 * CHICO OS — Styles
 * Светлая тема по умолчанию, тёмная через [data-theme="dark"]
 */

/* ======================== FONTS ======================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ======================== LIGHT THEME (DEFAULT) ======================== */
:root {
  --bg: #F0F0F0;
  --bg-secondary: #E5E5E5;
  --surface: #FFFFFF;
  --surface-hover: #F7F7F7;
  --text: #1A1A1A;
  --text-secondary: #4A4A4A;
  --text-muted: #8A8A8A;
  --border: #D5D5D5;
  --border-light: #EBEBEB;
  --accent: #E84E1B;
  --accent-hover: #D04318;
  --accent-light: #FCEEE8;
  --accent-text: #B83A15;
  --success: #3D3D3D;
  --success-light: #E0E0E0;
  --success-text: #2A2A2A;
  --warning: #E84E1B;
  --warning-light: #FCEEE8;
  --warning-text: #B83A15;
  --danger: #B91C1C;
  --danger-light: #F5D5D5;
  --danger-text: #7F1D1D;
  --info: #6A6A6A;
  --info-light: #EDEDED;
  --info-text: #4A4A4A;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.06);
  --shadow-md: 0 4px 8px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 12px 24px -4px rgba(0,0,0,0.12);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --sidebar-width: 260px;
  --sidebar-bg: #2A2A2A;
  --sidebar-text: #9A9A9A;
  --sidebar-text-hover: #FFFFFF;
  --sidebar-active-bg: rgba(232, 78, 27, 0.15);
  --sidebar-active-text: #E84E1B;
  --sidebar-border: #3A3A3A;
  --header-height: 56px;
  --transition: 0.15s ease;
}

/* ======================== DARK THEME ======================== */
[data-theme="dark"] {
  --bg: #1A1A1A;
  --bg-secondary: #222222;
  --surface: #2A2A2A;
  --surface-hover: #333333;
  --text: #F0F0F0;
  --text-secondary: #B0B0B0;
  --text-muted: #707070;
  --border: #3A3A3A;
  --border-light: #2A2A2A;
  --accent: #E84E1B;
  --accent-hover: #F06030;
  --accent-light: #3A2218;
  --accent-text: #F07850;
  --success: #5A5A5A;
  --success-light: #333333;
  --success-text: #C0C0C0;
  --warning: #E84E1B;
  --warning-light: #3A2218;
  --warning-text: #F07850;
  --danger: #DC2626;
  --danger-light: #3A1A1A;
  --danger-text: #F0A0A0;
  --info: #808080;
  --info-light: #2E2E2E;
  --info-text: #A0A0A0;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.3);
  --shadow-md: 0 4px 8px -2px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 24px -4px rgba(0,0,0,0.5);
  --sidebar-bg: #141414;
  --sidebar-text: #707070;
  --sidebar-text-hover: #E0E0E0;
  --sidebar-active-bg: rgba(232, 78, 27, 0.2);
  --sidebar-active-text: #F07850;
  --sidebar-border: #2A2A2A;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}

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

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

.hidden { display: none !important; }

/* ======================== SCROLLBAR ======================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ======================== LOGIN SCREEN ======================== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #2A2A2A;
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: #FFFFFF;
  border: none;
  border-top: 3px solid #E84E1B;
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  text-align: center;
  color: #1A1A1A;
}

.login-logo {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  color: #1A1A1A;
}

.login-logo span { color: #E84E1B; font-weight: 700; }

.login-subtitle {
  font-size: 13px;
  color: #8A8A8A;
  margin-bottom: 32px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.login-error {
  background: #F5D5D5;
  color: #7F1D1D;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.login-error.show { display: block; }

/* ======================== FORMS ======================== */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder { color: var(--text-muted); }

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

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

input[type="date"].form-input {
  color-scheme: light;
  position: relative;
}
input[type="date"].form-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.5;
  filter: none;
  transition: opacity var(--transition);
}
input[type="date"].form-input::-webkit-calendar-picker-indicator:hover {
  opacity: 0.8;
}
[data-theme="dark"] input[type="date"].form-input {
  color-scheme: dark;
}
[data-theme="dark"] input[type="date"].form-input::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
}

/* ======================== BUTTONS ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(232, 78, 27, 0.25);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(232, 78, 27, 0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(232, 78, 27, 0.2); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn-secondary:active { transform: translateY(0); }

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(185, 28, 28, 0.25);
}
.btn-danger:hover {
  background: #991B1B;
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.3);
  transform: translateY(-1px);
}
.btn-danger:active { transform: translateY(0); }

.btn-success {
  background: #16a34a;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.25);
}
.btn-success:hover {
  background: #15803d;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
  transform: translateY(-1px);
}
.btn-success:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text); }

.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: var(--radius-sm); }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); cursor: pointer; border: none; }

.btn .material-icons-round { font-size: 18px; }
.btn-sm .material-icons-round { font-size: 14px; }

/* ======================== APP LAYOUT ======================== */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ======================== SIDEBAR ======================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  z-index: 100;
}

.sidebar-logo {
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 24px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.5px;
  border-bottom: 1px solid var(--sidebar-border);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo span { color: #E84E1B; font-weight: 700; }

.sidebar-logo img { height: 28px; width: auto; }

.sidebar-logo-sub {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--sidebar-text);
  font-weight: 500;
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 2px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--sidebar-text);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  text-align: left;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--sidebar-text-hover);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--sidebar-active-text);
  font-weight: 600;
}

.nav-item .material-icons-round { font-size: 20px; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #E84E1B;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-text-hover);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--sidebar-text);
}

.sidebar-logout {
  background: none;
  border: none;
  color: var(--sidebar-text);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  display: flex;
}

.sidebar-logout:hover { color: #E84E1B; }

/* ======================== MAIN CONTENT ======================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.main-header {
  height: var(--header-height);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

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

.header-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #E84E1B;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-badge {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Header controls */
.header-control {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.header-control-btn {
  padding: 6px 10px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.header-control-btn:hover { color: var(--text); }

.header-control-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.hc-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  line-height: 1;
}
.header-control-btn.active .hc-count {
  background: var(--accent);
  color: #fff;
}

/* View container */
.view-container {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

/* ======================== CARDS ======================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
}

.card-body { padding: 24px; }
.card-body-flush { padding: 0; }

/* ======================== STAT CARDS ======================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 20px;
}

/* Compact stats (inline) */
.stats-compact {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stats-compact .stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  flex: 1;
  min-width: 130px;
}

.stats-compact .stat-item-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.stats-compact .stat-item-icon.accent { background: var(--accent-light); color: var(--accent); }
.stats-compact .stat-item-icon.green { background: var(--success-light); color: var(--success); }
.stats-compact .stat-item-icon.muted { background: var(--bg-secondary); color: var(--text-muted); }
[data-theme="dark"] .stats-compact .stat-item-icon.accent { color: var(--accent-text); }
[data-theme="dark"] .stats-compact .stat-item-icon.green { color: var(--success-text); }

.stats-compact .stat-item-value {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.stats-compact .stat-item-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-icon.blue { background: var(--accent-light); color: var(--accent); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.amber { background: var(--accent-light); color: var(--accent); }
.stat-icon.cyan { background: var(--info-light); color: var(--info); }
[data-theme="dark"] .stat-icon.blue { color: var(--accent-text); }
[data-theme="dark"] .stat-icon.green { color: var(--success-text); }
[data-theme="dark"] .stat-icon.amber { color: var(--accent-text); }
[data-theme="dark"] .stat-icon.cyan { color: var(--info-text); }

.stat-value {
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ======================== TABLES ======================== */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  white-space: nowrap;
}

td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--surface-hover); }

td strong { font-weight: 600; }

/* ======================== BADGES ======================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue { background: #EDEDED; color: #5A5A5A; }
.badge-green { background: #3D3D3D; color: #FFFFFF; }
.badge-amber { background: #FCEEE8; color: #B83A15; }
.badge-red { background: #F5D5D5; color: #7F1D1D; }
.badge-cyan { background: #E5E5E5; color: #6A6A6A; }
.badge-gray {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

[data-theme="dark"] .badge-blue { background: #3A3A3A; color: #A0A0A0; }
[data-theme="dark"] .badge-green { background: #4A4A4A; color: #E0E0E0; }
[data-theme="dark"] .badge-amber { background: #3A2218; color: #F07850; }
[data-theme="dark"] .badge-red { background: #4A1A1A; color: #F0A0A0; }
[data-theme="dark"] .badge-cyan { background: #333333; color: #909090; }

/* ======================== KANBAN ======================== */
.kanban {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: 400px;
}

.kanban-col {
  min-width: 240px;
  max-width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.kanban-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border: 1px solid var(--border);
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-count {
  background: var(--border);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 99px;
}

.kanban-body {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 8px;
  min-height: 100px;
}

.kanban-card {
  background: var(--surface);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border);
  cursor: grab;
  transition: all var(--transition);
}

.kanban-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.kanban-card:active { cursor: grabbing; }

.kanban-card-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.kanban-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.kanban-card-meta .material-icons-round { font-size: 14px; }

.kanban-empty {
  height: 60px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Drag & Drop states */
.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.kanban-body.drag-over {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* ======================== TABS ======================== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ======================== MODAL ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition);
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
}

.modal-close:hover { color: var(--text); background: var(--bg-secondary); }

.modal-body { padding: 24px; }

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

/* ======================== AI RESULTS ======================== */
.ai-result {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
}

.ai-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-weight: 700;
  color: var(--accent);
}

.ai-summary {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
}

.ai-task-list {
  list-style: none;
}

.ai-task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.ai-task-check {
  width: 20px;
  height: 20px;
  border: 2px solid #E84E1B;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #E84E1B;
  font-size: 14px;
}

.ai-task-info { flex: 1; }
.ai-task-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.ai-task-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 16px; }

/* ======================== SPINNER ======================== */
.spinner {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 24px;
  color: var(--text-muted);
}

.spinner::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ======================== EMPTY STATE ======================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .material-icons-round {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* ======================== SECTION ======================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ======================== PAGE SUBTITLE ======================== */
.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: -20px;
  margin-bottom: 24px;
}

/* ======================== DOC STATUS ======================== */
.doc-status { display: flex; gap: 4px; flex-wrap: wrap; }
.doc-lang { font-size: 10px; font-weight: 700; }

/* ======================== PRIORITY INDICATOR ======================== */
.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.priority-dot.high { background: #B91C1C; }
.priority-dot.medium { background: #E84E1B; }
.priority-dot.low { background: #8A8A8A; }

/* ======================== UTILITY ======================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ======================== RESPONSIVE ======================== */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  
  .sidebar.open { transform: translateX(0); }
  
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  
  .view-container { padding: 20px 16px; }
  
  .main-header { padding: 0 16px; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .kanban-col { min-width: 220px; }
  .login-box { padding: 32px 24px; }
}

/* ======================== LOGIN FORM OVERRIDES ======================== */
.login-box .form-group label { color: #4A4A4A; }
.login-box .form-input {
  background: #F5F5F5;
  border-color: #D5D5D5;
  color: #1A1A1A;
}
.login-box .form-input:focus {
  border-color: #E84E1B;
  box-shadow: 0 0 0 3px rgba(232, 78, 27, 0.15);
}
.login-box .form-input::placeholder { color: #AAAAAA; }
.login-box .header-control {
  background: #F0F0F0;
  border-color: #D5D5D5;
}
.login-box .header-control-btn { color: #8A8A8A; }
.login-box .header-control-btn.active { background: #FFFFFF; color: #E84E1B; }

/* ======================== SALES MODULE ======================== */
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.order-card:hover { box-shadow: var(--shadow-md); }

.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  cursor: pointer;
}

.order-card-header:hover { background: var(--surface-hover); }

.order-id {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.order-client {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}

.order-meta {
  display: flex;
  gap: 24px;
  align-items: center;
}

.order-meta-item {
  text-align: right;
}

.order-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.order-meta-value {
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

/* Progress Timeline */
.order-timeline {
  padding: 0 24px 24px;
  display: none;
}

.order-card.expanded .order-timeline,
.card.expanded .order-timeline { display: block; }

.timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 12px 0;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  flex: 1;
  position: relative;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--border);
  z-index: 1;
  transition: all var(--transition);
  flex-shrink: 0;
}

.timeline-step.completed .timeline-dot {
  background: #3D3D3D;
  border-color: #3D3D3D;
}

[data-theme="dark"] .timeline-step.completed .timeline-dot {
  background: #808080;
  border-color: #808080;
}

.timeline-step.active .timeline-dot {
  background: #E84E1B;
  border-color: #E84E1B;
  box-shadow: 0 0 0 4px rgba(232, 78, 27, 0.2);
}

.timeline-line {
  position: absolute;
  top: 5px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border);
}

.timeline-step:last-child .timeline-line { display: none; }

.timeline-step.completed .timeline-line {
  background: #3D3D3D;
}

[data-theme="dark"] .timeline-step.completed .timeline-line {
  background: #808080;
}

.timeline-label {
  font-size: 8px;
  text-align: center;
  margin-top: 6px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.25;
  max-width: 64px;
  word-break: break-word;
  hyphens: auto;
}

.timeline-step.completed .timeline-label {
  color: var(--text-secondary);
}

.timeline-step.active .timeline-label {
  color: #E84E1B;
  font-weight: 700;
}

.order-expand-icon {
  transition: transform var(--transition);
  color: var(--text-muted);
}

.order-card.expanded .order-expand-icon,
.card.expanded .order-expand-icon {
  transform: rotate(180deg);
}

/* Order Details Grid */
.order-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.order-detail-item { min-width: 0; }

.order-detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.order-detail-value {
  font-size: 14px;
  font-weight: 600;
}

/* ======================== CARD TITLE WITH ACCENT BAR ======================== */
.card-accent {
  border-left: 3px solid #E84E1B;
}

/* ======================== SECTION DIVIDER ======================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ======================== COMPACT KPI BAR ======================== */
.kpi-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.kpi-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  cursor: pointer;
  transition: all var(--transition);
  flex: 1;
  min-width: 150px;
}

.kpi-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.kpi-icon.accent { background: var(--accent-light); color: var(--accent); }
.kpi-icon.muted { background: var(--bg-secondary); color: var(--text-muted); }
[data-theme="dark"] .kpi-icon.accent { color: var(--accent-text); }

.kpi-value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

/* ======================== TASK ROW ======================== */
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--surface-hover); }

.task-row-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.task-row-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.task-row-meta .material-icons-round {
  font-size: 13px;
  vertical-align: middle;
}

.task-row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.task-row:hover .task-row-actions { opacity: 1; }

/* ======================== IMPORTANCE BADGE ======================== */
.importance-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.importance-badge.critical { background: #B91C1C; color: #fff; }
.importance-badge.high { background: var(--accent-light); color: var(--accent); }
.importance-badge.medium { background: var(--bg-secondary); color: var(--text-secondary); }
.importance-badge.low { background: var(--bg-secondary); color: var(--text-muted); }
[data-theme="dark"] .importance-badge.critical { background: #7F1D1D; color: #F0A0A0; }
[data-theme="dark"] .importance-badge.high { background: var(--accent-light); color: var(--accent-text); }

/* ======================== DEADLINE BADGE ======================== */
.deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

.deadline-badge.overdue { background: var(--danger-light); color: var(--danger-text); }
.deadline-badge.urgent { background: var(--warning-light); color: var(--warning-text); }
.deadline-badge.normal { background: var(--bg-secondary); color: var(--text-muted); }
.deadline-badge.done { background: var(--success-light); color: var(--success-text); }

/* ======================== FILE CHIP ======================== */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: default;
}

.file-chip .material-icons-round { font-size: 12px; }

/* ======================== DASHBOARD GRID ======================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: stretch;
}

.dashboard-grid > div:last-child {
  display: flex;
  flex-direction: column;
}

.dashboard-grid > div:last-child > .card:first-child {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dashboard-grid > div:last-child > .card:first-child > .card-body-flush {
  flex: 1;
  overflow-y: auto;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* ======================== SALES SUMMARY CARD ======================== */
.sales-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}

.sales-summary-item:last-child { border-bottom: none; }

.sales-summary-item:hover { background: var(--surface-hover); }

.sales-summary-client {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sales-summary-model {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sales-summary-right {
  text-align: right;
  flex-shrink: 0;
}

/* ======================== MODAL WIDE ======================== */
.modal.modal-wide {
  max-width: 680px;
}

/* ======================== TASK DETAIL ======================== */
.task-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.task-detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.task-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.task-detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-detail-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.task-detail-meta-value {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ======================== SUBTASK CHECKLIST ======================== */
.subtask-section {
  margin-bottom: 20px;
}

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

.subtask-header-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.subtask-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.subtask-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.subtask-item:hover { background: var(--surface-hover); }

.subtask-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  color: transparent;
  transition: all var(--transition);
}

.subtask-item.done .subtask-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.subtask-text {
  font-size: 13px;
  font-weight: 500;
}

.subtask-item.done .subtask-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ======================== STAGE HISTORY ======================== */
.stage-history {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.stage-history-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}

.stage-history-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 24px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}

.stage-history-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--surface);
  flex-shrink: 0;
  margin-top: 2px;
  z-index: 1;
}

.stage-history-item.completed .stage-history-dot { background: #3D3D3D; }
.stage-history-item.active .stage-history-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
[data-theme="dark"] .stage-history-item.completed .stage-history-dot { background: #808080; }

.stage-history-content { flex: 1; min-width: 0; }

.stage-history-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
}

.stage-history-date {
  font-size: 11px;
  color: var(--text-muted);
}

.stage-history-comment {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

.stage-history-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

/* ======================== PERMISSIONS TABLE ======================== */
.perm-table {
  width: 100%;
  border-collapse: collapse;
}

.perm-table th {
  font-size: 11px;
  padding: 10px 8px;
  text-align: center;
}

.perm-table th:first-child {
  text-align: left;
  min-width: 120px;
}

.perm-table td {
  padding: 10px 8px;
  text-align: center;
  font-size: 13px;
}

.perm-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.perm-toggle {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: all var(--transition);
}

.perm-toggle.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.perm-toggle:hover { border-color: var(--accent); }

/* ======================== ASSIGNEE CHIPS ======================== */
.assignee-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-secondary);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.assignee-chip .material-icons-round { font-size: 12px; }

/* ======================== FILE DROPZONE ======================== */
.file-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-secondary);
  margin-bottom: 8px;
}

.file-dropzone:hover,
.file-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.file-dropzone .material-icons-round {
  font-size: 28px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.file-dropzone:hover .material-icons-round,
.file-dropzone.dragover .material-icons-round {
  color: var(--accent);
}

.file-dropzone-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.file-dropzone-text strong {
  color: var(--accent);
}

/* ======================== EXPANDABLE TABLE ROW ======================== */
.expandable-row {
  cursor: pointer;
  transition: background var(--transition);
}

.expandable-row:hover { background: var(--surface-hover); }

.expand-detail-row {
  display: none;
}

.expand-detail-row.open {
  display: table-row;
}

.expand-detail-row td {
  padding: 0 !important;
}

.expand-detail-content {
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
}

/* ======================== FILE ITEM WITH META ======================== */
.file-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  max-width: 420px;
  transition: border-color 0.15s;
}
.file-item:hover { border-color: var(--text-muted); }
.file-item-icon { font-size: 16px; color: var(--accent); flex-shrink: 0; }
.file-item-info { flex: 1; min-width: 0; }
.file-item-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-meta { font-size: 11px; color: var(--text-muted); }
.file-item-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ======================== BLOCKER ITEMS ======================== */
.blocker-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 6px;
}
.blocker-item.active {
  background: var(--danger-light);
  border: 1px solid var(--danger);
  color: var(--danger-text);
}
.blocker-item.resolved {
  background: rgba(22, 163, 74, 0.06);
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: var(--text-muted);
}
.blocker-item.resolved .blocker-text { text-decoration: line-through; }
.blocker-icon { flex-shrink: 0; margin-top: 1px; }
.blocker-content { flex: 1; min-width: 0; }
.blocker-text { line-height: 1.5; }
.blocker-date { font-size: 11px; margin-top: 2px; opacity: 0.7; }

/* ======================== SUBTASK TIMELINE (detail view) ======================== */
.subtask-timeline-item {
  position: relative;
  padding-left: 28px;
  padding-bottom: 16px;
  border-left: 2px solid var(--border);
  margin-left: 8px;
}
.subtask-timeline-item:last-of-type { border-left-color: transparent; padding-bottom: 0; }
.subtask-timeline-dot {
  position: absolute;
  left: -8px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.subtask-timeline-item.done .subtask-timeline-dot {
  background: #16a34a;
  border-color: #16a34a;
}
.subtask-timeline-item.done .subtask-timeline-dot .material-icons-round { color: #fff; }
.subtask-timeline-dot:hover { border-color: var(--accent); }
.subtask-timeline-title { font-size: 13px; font-weight: 600; }
.subtask-timeline-item.done .subtask-timeline-title { text-decoration: line-through; color: var(--text-muted); }
.subtask-timeline-comment { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.subtask-timeline-files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* ======================== INLINE SUBTASK COMPLETE FORM ======================== */
.subtask-complete-form {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}
.subtask-complete-form .form-input { font-size: 12px; padding: 6px 10px; }

/* ======================== MEDIA PLAYER ======================== */
.media-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.media-player-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}
.media-player-container {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  max-width: 90vw;
  max-height: 90vh;
  min-width: 340px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.media-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.media-player-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-player-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  flex-shrink: 0;
}
.media-player-close:hover {
  color: var(--text-primary);
  background: var(--hover);
}
.media-player-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.media-player-video {
  width: 100%;
  max-height: 75vh;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: #000;
  outline: none;
}
.media-player-audio-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 48px;
  min-width: 360px;
}
.media-player-audio-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ff6b3d);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: audioPulse 2s ease-in-out infinite;
}
.media-player-audio-icon .material-icons-round {
  font-size: 36px;
  color: #fff;
}
.media-player-audio-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-player-audio {
  width: 100%;
  min-width: 300px;
  outline: none;
}
.media-player-image {
  max-width: 85vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.media-player-demo-notice {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}
@keyframes audioPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232, 78, 27, 0.3); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(232, 78, 27, 0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ======================== PERM SAVE BUTTON ======================== */
.perm-save-btn {
  transition: opacity 0.3s, transform 0.3s;
}
.perm-save-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
