/* ============================================================================
   UHURUPMS APP SHELL — Linear/Stripe-style dark-sidebar + light-content
   Built on top of brand.css tokens. Include AFTER brand.css.
   ============================================================================ */

:root {
  --sidebar-bg:        #0f172a;
  --sidebar-bg-hover:  #1e293b;
  --sidebar-text:      #cbd5e1;
  --sidebar-text-muted:#64748b;
  --sidebar-text-active:#ffffff;
  --sidebar-active-bg: rgba(253, 75, 81, 0.15);
  --sidebar-active-bar:#fd4b51;
  --sidebar-divider:   rgba(255, 255, 255, 0.05);
  --sidebar-width:     240px;
  --header-height:     56px;
  --content-max:       1280px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink-900);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.app-shell        { display: flex; min-height: 100vh; }
.app-sidebar      { width: var(--sidebar-width); flex-shrink: 0;
                    background: var(--sidebar-bg); color: var(--sidebar-text);
                    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.app-main         { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sb-brand         { padding: 18px 20px; border-bottom: 1px solid var(--sidebar-divider); }
.sb-brand img     { height: 28px; width: auto; }

.sb-tenant        { padding: 14px 20px; border-bottom: 1px solid var(--sidebar-divider); }
.sb-tenant-name   { font-size: 13px; font-weight: 600; color: var(--sidebar-text-active); }
.sb-tenant-plan   { font-size: 11px; color: var(--sidebar-text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

.sb-section       { padding: 14px 20px 6px; font-size: 11px; font-weight: 600;
                    text-transform: uppercase; letter-spacing: 0.06em; color: var(--sidebar-text-muted); }

.sb-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  cursor: pointer;
}
.sb-link:hover    { background: var(--sidebar-bg-hover); color: var(--sidebar-text-active); text-decoration: none; }
.sb-link.active   { background: var(--sidebar-active-bg); color: var(--sidebar-text-active);
                    border-left-color: var(--sidebar-active-bar); }
.sb-link.coming-soon::after {
  content: 'soon';
  margin-left: auto;
  font-size: 9.5px; font-weight: 600;
  background: rgba(255, 255, 255, 0.08); color: var(--sidebar-text-muted);
  padding: 2px 6px; border-radius: 8px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.sb-link .icon    { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }

.sb-footer        { margin-top: auto; padding: 14px 20px; border-top: 1px solid var(--sidebar-divider); }
.sb-user          { display: flex; align-items: center; gap: 10px; }
.sb-avatar        { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-gradient);
                    display: flex; align-items: center; justify-content: center;
                    font-weight: 600; color: white; font-size: 12px; }
.sb-user-name     { font-size: 13px; font-weight: 500; color: var(--sidebar-text-active); line-height: 1.2; }
.sb-user-role     { font-size: 11px; color: var(--sidebar-text-muted); margin-top: 2px; }
.sb-logout        { color: var(--sidebar-text-muted); cursor: pointer; padding: 6px;
                    border-radius: 6px; transition: background 0.12s, color 0.12s; }
.sb-logout:hover  { background: var(--sidebar-bg-hover); color: var(--err); }

.app-header {
  height: var(--header-height);
  background: var(--paper);
  border-bottom: 1px solid var(--ink-100);
  display: flex; align-items: center; padding: 0 28px;
  position: sticky; top: 0; z-index: 10;
}
.page-title       { font-size: 18px; font-weight: 600; color: var(--ink-900); }
.page-subtitle    { font-size: 13px; color: var(--ink-500); margin-left: 14px; }

.app-content {
  flex: 1; padding: 28px;
  max-width: var(--content-max);
  width: 100%;
}

.card {
  background: var(--paper);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--ink-900); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
              gap: 16px; margin-bottom: 24px; }
.stat-tile  { background: var(--paper); border: 1px solid var(--ink-100);
              border-radius: var(--radius); padding: 18px 20px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--ink-500);
              text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--ink-900); line-height: 1; }
.stat-meta  { font-size: 12px; color: var(--ink-500); margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  font-size: 13px; font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand-primary); color: white; }
.btn-primary:hover { background: #e93f45; box-shadow: var(--shadow); }
.btn-secondary { background: var(--paper); color: var(--ink-700); border-color: var(--ink-300); }
.btn-secondary:hover { background: var(--ink-50); }
.btn-ghost { background: transparent; color: var(--ink-700); }
.btn-ghost:hover { background: var(--ink-100); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500;
              color: var(--ink-700); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-900);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(253, 75, 81, 0.12);
}
.form-textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.form-help { font-size: 11.5px; color: var(--ink-500); margin-top: 4px; }
.form-error { font-size: 11.5px; color: var(--err); margin-top: 4px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 12px;
  background: var(--ink-50);
  font-weight: 600; color: var(--ink-700);
  border-bottom: 1px solid var(--ink-100);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--ink-100); }
.table tr:hover td { background: var(--ink-50); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px; font-weight: 600;
  border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-open     { background: #dbeafe; color: #1e40af; }
.badge-progress { background: #ede9fe; color: #5b21b6; }
.badge-done     { background: #d1fae5; color: #065f46; }
.badge-cancelled{ background: #fee2e2; color: #991b1b; }
.badge-low      { background: var(--ink-100); color: var(--ink-700); }
.badge-medium   { background: #dbeafe; color: #1e40af; }
.badge-high     { background: #fef3c7; color: #92400e; }
.badge-urgent   { background: #fee2e2; color: #991b1b; }

.toast-wrap {
  position: fixed; top: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 1000; pointer-events: none;
}
.toast {
  background: var(--ink-900); color: white;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  max-width: 320px;
  animation: toast-in 0.2s ease;
}
.toast-error { background: var(--err); }
.toast-ok    { background: var(--ok); }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.coming-soon-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60vh; text-align: center; color: var(--ink-500);
}
.coming-soon-icon  { font-size: 56px; margin-bottom: 16px; opacity: 0.6; }
.coming-soon-title { font-size: 22px; font-weight: 600; color: var(--ink-700); margin-bottom: 8px; }
.coming-soon-text  { font-size: 14px; max-width: 380px; line-height: 1.5; }

.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-50);
  padding: 20px;
}
.login-card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand img { height: 38px; width: auto; margin-bottom: 14px; }
.login-title    { font-size: 20px; font-weight: 600; color: var(--ink-900); margin-bottom: 4px; text-align: center; }
.login-subtitle { font-size: 13.5px; color: var(--ink-500); text-align: center; margin-bottom: 24px; }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fade-in 0.15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--paper);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--ink-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--ink-900); }
.modal-close { cursor: pointer; color: var(--ink-500); font-size: 20px; line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--ink-100);
  display: flex; gap: 8px; justify-content: flex-end;
}
