@tailwind base;
@tailwind components;
@tailwind utilities;

/* UI Pagination Component Styling (for Pagy) */
.ui-pagination .pagy {
  @apply flex items-center space-x-2;
}

.ui-pagination .pagy a,
.ui-pagination .pagy span {
  @apply inline-flex items-center justify-center px-3 py-2 text-sm font-medium rounded-md border transition-all duration-200 shadow-sm;
}

.ui-pagination .pagy a {
  @apply text-slate-700 bg-white border-slate-300 hover:bg-slate-50 hover:text-slate-900 hover:border-slate-400 hover:shadow-md;
}

.ui-pagination .pagy span.current {
  @apply bg-iihs-700 text-white border-iihs-700 shadow-md;
}

.ui-pagination .pagy span.gap {
  @apply px-3 py-2 text-sm font-medium text-slate-500 border-0 bg-transparent shadow-none;
}

/* Disabled state for pagination buttons (links without href) */
.ui-pagination .pagy a:not([href]) {
  @apply text-slate-400 bg-slate-100 border-slate-200 cursor-not-allowed;
}

@layer base {
  html {
    @apply text-slate-900;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  }

  body {
    @apply bg-slate-50;
  }

  h1, h2, h3, h4, h5, h6 {
    @apply font-semibold tracking-tight;
  }

  h1 {
    @apply text-3xl sm:text-4xl;
  }

  h2 {
    @apply text-2xl sm:text-3xl;
  }

  h3 {
    @apply text-xl sm:text-2xl;
  }

  /* Override Tailwind's list reset for Trix editor */
  trix-editor ul {
    list-style-type: disc !important;
    margin-left: 1.5rem !important;
    padding-left: 0 !important;
  }

  trix-editor ol {
    list-style-type: decimal !important;
    margin-left: 1.5rem !important;
    padding-left: 0 !important;
  }

  trix-editor li {
    display: list-item !important;
  }
}

@layer components {
  .btn {
    @apply inline-flex items-center justify-center rounded-md border border-transparent px-4 py-2 text-sm font-medium shadow-sm transition-all duration-150 focus:outline-none focus:ring-2 focus:ring-offset-2;
  }

  .btn:active {
    @apply transform scale-95 shadow-inner;
  }

  .btn-loading {
    @apply cursor-not-allowed opacity-75;
    position: relative;
  }

  .btn-loading .btn-text {
    @apply opacity-0;
  }

  .btn-loading .btn-spinner {
    @apply opacity-100;
  }

  .btn-spinner {
    @apply absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 opacity-0 transition-all duration-200;
    animation: spin 1s linear infinite;
  }

  @keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
  }

  /* File upload area enhancements */
  .file-upload-area {
    @apply border-2 border-dashed border-slate-300 rounded-lg p-6 text-center hover:border-iihs-400 transition-colors;
  }

  .file-upload-area.drag-over {
    @apply border-iihs-500 bg-iihs-50;
  }

  .btn-primary {
    @apply bg-iihs-700 text-white hover:bg-iihs-800 focus-visible:ring-iihs-500;
  }

  .btn-secondary {
    @apply border-slate-300 bg-white text-slate-700 hover:bg-slate-50 focus:ring-blue-500;
  }

  .btn-outline {
    @apply border-slate-300 bg-transparent text-slate-700 hover:bg-slate-50 focus:ring-blue-500;
  }

  .btn-danger {
    @apply bg-red-600 text-white hover:bg-red-700 focus:ring-red-500;
  }

  .btn-sm {
    @apply px-3 py-1.5 text-xs;
  }

  .btn-lg {
    @apply px-6 py-3 text-base;
  }

  .input {
    @apply w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900 placeholder-slate-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500;
  }

  .card {
    @apply rounded-lg border border-slate-200 bg-white shadow-sm;
  }

  .auth-layout {
    @apply flex flex-col items-center justify-center bg-iihs-700 px-8 py-10 text-white;
  }

  .auth-card {
    @apply w-full max-w-md rounded-lg bg-white p-8 shadow-lg;
  }

  .auth-header {
    @apply mb-6 text-center;
  }

  .auth-form {
    @apply space-y-4;
  }

  /* Specific login form input styling */
  .auth-form input[type="email"],
  .auth-form input[type="password"] {
    color: #0f172a !important; /* slate-900 */
    background-color: #ffffff !important;
    -webkit-text-fill-color: #0f172a !important; /* For Safari */
  }

  .auth-form input[type="email"]:focus,
  .auth-form input[type="password"]:focus {
    color: #0f172a !important; /* slate-900 */
    -webkit-text-fill-color: #0f172a !important; /* For Safari */
  }

  .auth-form input::placeholder {
    color: #94a3b8 !important; /* slate-400 */
    opacity: 1 !important;
  }

  .form-group {
    @apply space-y-1;
  }

  .form-label {
    @apply block text-sm font-medium text-slate-700;
  }

  .form-input {
    @apply w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900 placeholder-slate-400 focus:border-iihs-700 focus:outline-none focus:ring-1 focus:ring-iihs-700;
  }

  .form-textarea {
    @apply w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900 placeholder-slate-400 focus:border-iihs-700 focus:outline-none focus:ring-1 focus:ring-iihs-700;
  }

  .form-select {
    @apply w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900 focus:border-iihs-700 focus:outline-none focus:ring-1 focus:ring-iihs-700;
  }

  .form-error {
    @apply text-sm text-red-600;
  }

  .alert {
    @apply rounded-md p-4;
  }

  .alert-success {
    @apply bg-green-50 text-green-800;
  }

  .alert-error {
    @apply bg-red-50 text-red-800;
  }

  .alert-warning {
    @apply bg-yellow-50 text-yellow-800;
  }

  .alert-info {
    @apply bg-blue-50 text-blue-800;
  }

  .stats-card {
    @apply rounded-lg border border-slate-200 bg-white p-6 shadow-sm;
  }

  .main-layout {
    @apply flex h-screen overflow-hidden;
  }

  .main-content {
    @apply flex flex-1 flex-col overflow-hidden;
  }

  .page-content {
    @apply flex-1 overflow-auto bg-slate-50 p-6;
  }

  .page-container {
    @apply mx-auto max-w-7xl;
  }

  /* Navigation Styles */
  .nav-link {
    @apply flex items-center rounded-md px-3 py-2 text-sm font-medium transition-colors text-slate-600 hover:bg-slate-100 hover:text-slate-900;
    box-shadow: none !important;
    border: none !important;
  }

  .nav-link-active {
    @apply bg-iihs-50 text-iihs-700;
    box-shadow: none !important;
  }

  .nav-link i {
    @apply flex-shrink-0;
  }

  /* Navigation section styles */
  .nav-section-header {
    @apply px-3 py-2 border-b border-slate-200;
  }

  .nav-section-title {
    @apply text-xs font-semibold text-slate-500 uppercase tracking-wider;
  }

  .nav-link-sub {
    @apply ml-2 pl-2 border-l border-slate-200;
    box-shadow: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: none !important;
  }

  .nav-link-sub:hover {
    @apply bg-slate-50 border-l-slate-300;
    box-shadow: none !important;
  }

  .nav-link-sub.nav-link-active {
    @apply bg-iihs-50 text-iihs-900 border-l-iihs-600 border-l-2;
    box-shadow: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: none !important;
  }

  /* Additional utility classes */
  .line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .sidebar-item {
    @apply flex items-center px-3 py-2 text-sm font-medium rounded-md transition-colors;
  }

  .sidebar-item.active {
    @apply bg-iihs-50 text-iihs-700;
  }

  .sidebar-item:hover {
    @apply bg-slate-100 text-slate-900;
  }

  /* File Upload Component Styles */
  .file-drop-zone {
    @apply relative;
  }

  .file-drop-zone.drag-over .file-upload-area {
    @apply border-iihs-300 bg-iihs-50;
  }

  .file-upload-area {
    @apply mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md transition-colors;
  }

  .file-preview {
    @apply mt-1 p-4 bg-slate-50 rounded-md border border-slate-200;
  }

  .file-preview .file-info {
    @apply flex items-center justify-between;
  }

  .file-preview .file-details {
    @apply flex items-center space-x-3;
  }

  .file-preview .file-icon {
    @apply text-2xl;
  }

  .file-preview .file-name {
    @apply text-sm font-medium text-slate-900;
  }

  .file-preview .file-size {
    @apply text-xs text-slate-500;
  }

  .file-preview .file-actions {
    @apply flex space-x-2;
  }

  .remove-file {
    @apply text-red-600 hover:text-red-800 text-sm cursor-pointer;
  }

  /* Drag and drop enhancement */
  .file-drop-zone.drag-over {
    @apply ring-2 ring-iihs-500 ring-offset-2;
  }

  /* Clickable table rows */
  .job-row {
    @apply cursor-pointer select-none;
  }

  .job-row:hover {
    @apply bg-slate-50;
  }

  .job-row:active {
    @apply bg-slate-100 transform scale-[0.999];
  }

  /* Rich Text Editor Styles */
  .rich-text-field {
    @apply border border-slate-200 rounded-md;
  }

  .rich-text-field trix-editor {
    @apply min-h-[120px] p-3 focus:border-iihs-700 focus:ring-1 focus:ring-iihs-700 focus:outline-none;
  }

  /* Trix Editor Content Styling */
  trix-editor {
    line-height: 1.6;
  }

  trix-editor ul,
  trix-editor .attachment-gallery > .attachment {
    list-style-type: disc !important;
    margin-left: 1.5rem !important;
    margin-bottom: 1rem !important;
    padding-left: 0 !important;
  }

  trix-editor ol {
    list-style-type: decimal !important;
    margin-left: 1.5rem !important;
    margin-bottom: 1rem !important;
    padding-left: 0 !important;
  }

  trix-editor li {
    margin-bottom: 0.25rem !important;
    padding-left: 0.25rem !important;
    display: list-item !important;
  }

  trix-editor ul li {
    list-style-type: disc !important;
  }

  trix-editor ol li {
    list-style-type: decimal !important;
  }

  /* Ensure lists are visible */
  trix-editor ul,
  trix-editor ol {
    display: block !important;
  }

  trix-editor blockquote {
    border-left: 4px solid #e2e8f0;
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #64748b;
  }

  trix-editor pre {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
  }

  trix-editor h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
  }

  trix-editor strong {
    font-weight: 600;
  }

  trix-editor em {
    font-style: italic;
  }

  trix-editor a {
    color: var(--iihs-700);
    text-decoration: underline;
  }

  trix-editor a:hover {
    color: var(--iihs-800);
  }

  /* Trix Toolbar Styling */
  trix-toolbar {
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem;
  }

  trix-toolbar .trix-button-group {
    margin-right: 0.75rem;
    border-radius: 0.375rem;
    overflow: hidden;
  }

  trix-toolbar .trix-button {
    background: white;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  trix-toolbar .trix-button:hover {
    background: #f8fafc;
    color: #334155;
  }

  trix-toolbar .trix-button.trix-active {
    background: var(--iihs-700);
    color: white;
    border-color: var(--iihs-700);
  }

  trix-toolbar .trix-button:not(:first-child) {
    border-left: none;
  }

  trix-toolbar .trix-button-group:last-child {
    margin-right: 0;
  }

  /* Search Input Icon Fix */
  .search-input-container {
    @apply relative;
  }

  .search-input-container .search-icon {
    @apply absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400 pointer-events-none z-10;
  }

  .search-input-container input {
    @apply pl-10;
  }

  /* Custom select styling to prevent arrow overlap */
  .custom-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }

  /* Ensure form inputs have proper text visibility */
  input[type="email"],
  input[type="password"],
  input[type="text"],
  textarea,
  select {
    color: #0f172a !important; /* slate-900 */
    background-color: #ffffff !important;
  }

  input[type="email"]:focus,
  input[type="password"]:focus,
  input[type="text"]:focus,
  textarea:focus,
  select:focus {
    color: #0f172a !important; /* slate-900 */
  }

  /* Ensure placeholder text is visible */
  input::placeholder,
  textarea::placeholder {
    color: #94a3b8 !important; /* slate-400 */
    opacity: 1 !important;
  }
}

/* Custom IIHS color definitions */
:root {
  --iihs-50: #fef7f3;
  --iihs-100: #fde8dc;
  --iihs-200: #fbd5bf;
  --iihs-300: #f7b896;
  --iihs-400: #f19066;
  --iihs-500: #ed7142;
  --iihs-600: #de5a2a;
  --iihs-700: #881803;
  --iihs-800: #a0461f;
  --iihs-900: #83391c;
  --iihs-950: #471b0b;
}

/* Tailwind color utilities for IIHS brand */
.bg-iihs-50 { background-color: var(--iihs-50); }
.bg-iihs-100 { background-color: var(--iihs-100); }
.bg-iihs-200 { background-color: var(--iihs-200); }
.bg-iihs-300 { background-color: var(--iihs-300); }
.bg-iihs-400 { background-color: var(--iihs-400); }
.bg-iihs-500 { background-color: var(--iihs-500); }
.bg-iihs-600 { background-color: var(--iihs-600); }
.bg-iihs-700 { background-color: var(--iihs-700); }
.bg-iihs-800 { background-color: var(--iihs-800); }
.bg-iihs-900 { background-color: var(--iihs-900); }
.bg-iihs-950 { background-color: var(--iihs-950); }

.text-iihs-50 { color: var(--iihs-50); }
.text-iihs-100 { color: var(--iihs-100); }
.text-iihs-200 { color: var(--iihs-200); }
.text-iihs-300 { color: var(--iihs-300); }
.text-iihs-400 { color: var(--iihs-400); }
.text-iihs-500 { color: var(--iihs-500); }
.text-iihs-600 { color: var(--iihs-600); }
.text-iihs-700 { color: var(--iihs-700); }
.text-iihs-800 { color: var(--iihs-800); }
.text-iihs-900 { color: var(--iihs-900); }
.text-iihs-950 { color: var(--iihs-950); }

.border-iihs-50 { border-color: var(--iihs-50); }
.border-iihs-100 { border-color: var(--iihs-100); }
.border-iihs-200 { border-color: var(--iihs-200); }
.border-iihs-300 { border-color: var(--iihs-300); }
.border-iihs-400 { border-color: var(--iihs-400); }
.border-iihs-500 { border-color: var(--iihs-500); }
.border-iihs-600 { border-color: var(--iihs-600); }
.border-iihs-700 { border-color: var(--iihs-700); }
.border-iihs-800 { border-color: var(--iihs-800); }
.border-iihs-900 { border-color: var(--iihs-900); }
.border-iihs-950 { border-color: var(--iihs-950); }

.ring-iihs-50 { --tw-ring-color: var(--iihs-50); }
.ring-iihs-100 { --tw-ring-color: var(--iihs-100); }

/* IIHS admin design system */
:root {
  --admin-bg: #f6f5f1;
  --admin-surface: #ffffff;
  --admin-ink: #20221f;
  --admin-muted: #6e7168;
  --admin-faint: #9a9c93;
  --admin-border: #e5e3da;
  --admin-border-strong: #d6d3c7;
  --admin-maroon: #7e2a1c;
  --admin-maroon-dark: #601f14;
  --admin-maroon-tint: #f7e9e5;
  --admin-open: #2e6e4e;
  --admin-open-tint: #e4f1e9;
  --admin-closed: #7a7d74;
  --admin-closed-tint: #ebeae4;
  --admin-draft: #9a6a1e;
  --admin-draft-tint: #f5ebdb;
  --admin-danger: #b3261e;
  --admin-danger-tint: #fbeae9;
  --admin-radius: 10px;
  --admin-shadow-sm: 0 1px 2px rgba(32, 34, 31, 0.05);
  --admin-shadow-md: 0 4px 16px rgba(32, 34, 31, 0.08);
}

html,
body {
  font-family: "Fira Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.icon {
  display: inline-block;
  flex-shrink: 0;
  height: 1rem;
  width: 1rem;
}

.icon-sm {
  height: .875rem;
  width: .875rem;
}

.icon-lg {
  height: 1.25rem;
  width: 1.25rem;
}

.admin-shell {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  background: var(--admin-bg);
  color: var(--admin-ink);
  font-size: 14px;
}

.admin-sidebar {
  position: relative;
  display: flex;
  width: 230px;
  flex-shrink: 0;
  flex-direction: column;
  border-right: 1px solid var(--admin-border);
  background: var(--admin-surface);
  padding: 20px 14px;
  transition: width .18s ease;
}

.admin-sidebar.w-20 {
  width: 72px;
}

.admin-sidebar-toggle {
  position: absolute;
  right: -12px;
  top: 76px;
  z-index: 10;
  display: inline-flex;
  height: 24px;
  width: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  color: var(--admin-muted);
  box-shadow: var(--admin-shadow-sm);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 20px;
}

.admin-brand-mark {
  display: flex;
  height: 28px;
  width: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--admin-maroon);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.admin-brand-name {
  color: var(--admin-ink);
  font-size: 14.5px;
  font-weight: 700;
}

.admin-nav {
  flex: 1;
}

.admin-nav-group {
  margin-bottom: 18px;
}

.admin-nav-label {
  margin-bottom: 6px;
  padding: 0 10px;
  color: var(--admin-faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--admin-ink);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
}

.admin-nav-item:hover {
  background: #f2f0ea;
}

.admin-nav-item.active {
  background: var(--admin-maroon-tint);
  color: var(--admin-maroon-dark);
  font-weight: 600;
}

.admin-sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--admin-border);
  padding-top: 14px;
}

.admin-main {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.admin-topbar {
  display: flex;
  height: 56px;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-bottom: 1px solid var(--admin-border);
  background: var(--admin-surface);
  padding: 0 28px;
}

.admin-user {
  text-align: right;
  line-height: 1.25;
}

.admin-user-name {
  font-size: 13px;
  font-weight: 600;
}

.admin-user-role {
  color: var(--admin-muted);
  font-size: 11.5px;
}

.admin-avatar {
  display: flex;
  height: 32px;
  width: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #efe3da;
  color: var(--admin-maroon-dark);
  font-size: 12px;
  font-weight: 700;
}

.admin-content {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--admin-bg);
  padding: 26px 28px 40px;
}

.admin-container {
  max-width: 1400px;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.page-title {
  margin: 0 0 4px;
  color: var(--admin-ink);
  font-size: 23px;
  font-weight: 700;
}

.page-subtitle {
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.panel,
.card {
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow-sm);
}

.panel {
  min-width: 0;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--admin-border);
  padding: 14px;
}

.search-wrap {
  position: relative;
  min-width: 240px;
  flex: 1 1 300px;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  z-index: 1;
  color: var(--admin-faint);
  pointer-events: none;
  transform: translateY(-50%);
}

.candidates-search-bar {
  align-items: center;
  gap: 10px;
}

.candidates-search-bar .search-wrap {
  flex: 1 1 auto;
  min-width: 360px;
}

.candidates-search-bar .btn {
  min-height: 40px;
  flex: 0 0 auto;
}

.jobs-panel {
  overflow: hidden;
}

.jobs-filter-bar {
  flex-wrap: wrap;
  align-items: center;
  overflow: hidden;
}

.jobs-filter-bar .search-wrap {
  flex: 1 1 280px;
  min-width: 260px;
  max-width: 380px;
}

.jobs-filter-bar .admin-select {
  flex: 1 1 145px;
  min-width: 138px;
  max-width: 240px;
}

.jobs-date-filter-row {
  display: flex;
  flex: 1 0 100%;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.jobs-date-filter-row input[type="date"].admin-input {
  flex: 0 0 158px;
  width: 158px;
}

.jobs-date-filter-row .filter-date-label {
  color: var(--admin-muted);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.jobs-date-filter-row .btn,
.jobs-date-filter-row .reset-link {
  flex: 0 0 auto;
}

.jobs-date-filter-row .reset-link {
  white-space: nowrap;
}

.search-wrap .icon,
.search-input-container .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  color: var(--admin-faint);
  transform: translateY(-50%);
}

.admin-input,
.admin-select,
.form-input,
.form-select,
.input {
  border: 1px solid var(--admin-border-strong) !important;
  border-radius: 7px !important;
  background: #fcfcfa !important;
  color: var(--admin-ink) !important;
  font-family: inherit;
  font-size: 13px;
}

.admin-input,
.admin-select {
  min-height: 38px;
  padding: 9px 10px;
}

.admin-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236E7168' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.7' d='m6 8 4 4 4-4'/%3e%3c/svg%3e") !important;
  background-position: right 12px center !important;
  background-repeat: no-repeat !important;
  background-size: 16px 16px !important;
  padding-right: 38px !important;
}

.admin-input.with-icon {
  padding-left: 34px;
}

.admin-input:focus,
.admin-select:focus,
.form-input:focus,
.form-select:focus,
.input:focus {
  border-color: var(--admin-maroon) !important;
  outline: 2px solid #d9c2ba !important;
  outline-offset: -1px !important;
  box-shadow: none !important;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: var(--admin-shadow-sm);
}

.btn-primary {
  border-color: var(--admin-maroon) !important;
  background: var(--admin-maroon) !important;
  color: #fff !important;
}

.btn-primary:hover {
  background: var(--admin-maroon-dark) !important;
}

.btn-secondary,
.btn-outline {
  border-color: var(--admin-border-strong) !important;
  background: #fcfcfa !important;
  color: var(--admin-ink) !important;
}

.btn-danger {
  border-color: var(--admin-danger) !important;
  background: var(--admin-danger) !important;
  color: #fff !important;
}

.reset-link {
  border: 0;
  background: transparent;
  color: var(--admin-maroon);
  font-size: 12.5px;
  font-weight: 600;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  min-width: 960px;
  width: 100%;
  border-collapse: collapse;
}

.admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--admin-border);
  background: #fbfaf7;
  padding: 11px 14px;
  color: var(--admin-muted);
  text-align: left;
  font-size: 10.7px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-table tbody tr {
  border-bottom: 1px solid var(--admin-border);
  transition: background .1s ease;
}

.admin-table tbody tr:hover {
  background: #faf8f4;
}

.admin-table td {
  padding: 12px 14px;
  vertical-align: middle;
  color: var(--admin-ink);
  font-size: 13.2px;
}

.data-text {
  font-variant-numeric: tabular-nums;
  color: var(--admin-muted);
}

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
}

.sort-arrow {
  color: var(--admin-faint);
  font-size: 9px;
}

.sort-arrow.active {
  color: var(--admin-maroon);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 9px 4px 7px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  height: 6px;
  width: 6px;
  border-radius: 999px;
  background: currentColor;
}

.status-open {
  background: var(--admin-open-tint);
  color: var(--admin-open);
}

.status-closed,
.status-withdrawn {
  background: var(--admin-closed-tint);
  color: var(--admin-closed);
}

.status-draft,
.status-on_hold {
  background: var(--admin-draft-tint);
  color: var(--admin-draft);
}

.type-pill,
.category-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
}

.type-regular {
  background: #f5e9e3;
  color: var(--admin-maroon-dark);
}

.type-contractual {
  background: #efe9f5;
  color: #5d3e8c;
}

.icon-btn {
  display: inline-flex;
  height: 28px;
  width: 28px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--admin-muted);
  transition: background .1s ease, color .1s ease;
}

.icon-btn:hover {
  background: var(--admin-maroon-tint);
  color: var(--admin-maroon-dark);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--admin-border);
  padding: 12px 14px;
  color: var(--admin-muted);
  font-size: 12px;
}

.page-btn {
  border: 1px solid var(--admin-border-strong);
  border-radius: 6px;
  background: #fcfcfa;
  color: var(--admin-ink);
  padding: 5px 10px;
  font-size: 12px;
}

.page-btn.current {
  border-color: var(--admin-maroon);
  background: var(--admin-maroon);
  color: #fff;
}

.empty-state,
.error-state,
.loading-state {
  padding: 56px 20px;
  text-align: center;
  color: var(--admin-muted);
}

.empty-state .icon,
.error-state .icon {
  margin: 0 auto 10px;
  height: 34px;
  width: 34px;
  color: var(--admin-faint);
}

.error-state .icon {
  color: var(--admin-danger);
}

.loading-spinner,
.btn-spinner {
  display: inline-block;
  height: 1rem;
  width: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: admin-spin .75s linear infinite;
}

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

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(32, 34, 31, .36);
  padding: 24px;
}

.confirm-backdrop.hidden {
  display: none;
}

.confirm-dialog {
  display: grid;
  max-width: 420px;
  grid-template-columns: auto 1fr;
  gap: 14px;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
  padding: 20px;
  box-shadow: var(--admin-shadow-md);
}

.confirm-icon {
  display: flex;
  height: 38px;
  width: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--admin-danger-tint);
  color: var(--admin-danger);
}

.confirm-copy h2 {
  margin: 0;
  color: var(--admin-ink);
  font-size: 16px;
  font-weight: 700;
}

.confirm-copy p {
  margin: 6px 0 0;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.45;
}

.confirm-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.large-screen-message {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: var(--admin-bg);
  padding: 24px;
  text-align: center;
}

.large-screen-message-inner {
  max-width: 420px;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
  padding: 24px;
  box-shadow: var(--admin-shadow-sm);
}

@media (max-width: 1023px) {
  .admin-shell {
    display: none;
  }

  .large-screen-message {
    display: flex;
  }
}
.ring-iihs-200 { --tw-ring-color: var(--iihs-200); }
.ring-iihs-300 { --tw-ring-color: var(--iihs-300); }
.ring-iihs-400 { --tw-ring-color: var(--iihs-400); }
.ring-iihs-500 { --tw-ring-color: var(--iihs-500); }
.ring-iihs-600 { --tw-ring-color: var(--iihs-600); }
.ring-iihs-700 { --tw-ring-color: var(--iihs-700); }
.ring-iihs-800 { --tw-ring-color: var(--iihs-800); }
.ring-iihs-900 { --tw-ring-color: var(--iihs-900); }
.ring-iihs-950 { --tw-ring-color: var(--iihs-950); }


/* Flash Messages / Toast Notifications (bottom-right positioned) */
.flash-message {
  animation: flashMessage 3s forwards;
}

@keyframes flashMessage {
  0% {
    opacity: 0;
    transform: translateX(100%);
  }

  8% {
    opacity: 1;
    transform: translateX(0);
  }

  92% {
    opacity: 1;
    transform: translateX(0);
  }

  100% {
    opacity: 0;
    transform: translateX(100%);
  }
}
