/* Railway-Inspired Design System for Estimax */

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

:root {
  /* Railway-inspired color palette */
  --bg-primary: #09090b;
  --bg-secondary: #27272a;
  --bg-tertiary: #3f3f46;
  --bg-elevated: #3f3f46;
  --bg-hover: #52525b;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-normal: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);

  --text-primary: #ffffff;
  --text-secondary: #a1a1a1;
  --text-tertiary: #6b6b6b;
  --text-muted: #525252;

  --accent-primary: #7c3aed;
  --accent-hover: #8b5cf6;
  --accent-soft: rgba(124, 58, 237, 0.1);

  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --error: #ef4444;
  --error-soft: rgba(239, 68, 68, 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #13111C;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  position: relative;
  overflow-x: hidden;
}

/* Railway-style dot pattern background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle, #292834 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

/* Radial gradient accent */
body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(124, 58, 237, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0;
  padding: 0 48px;
}

/* Typography */
h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
}

h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--text-primary);
}

h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
  color: var(--text-primary);
}

h4 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-primary);
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.meta {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Navigation - Railway style */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #211F2D;
  border-bottom: 1px solid #33323E;
  padding: 0;
  margin-bottom: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 24px;
}

.nav__inner::-webkit-scrollbar {
  display: none;
}

.nav__item {
  position: relative;
  padding: 14px 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 0;
  font-family: inherit;
  box-shadow: none;
}

.nav__item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.2s ease;
}

.nav__item:hover:not(.active) {
  color: var(--text-primary);
}

.nav__item.active {
  color: var(--text-primary);
}

.nav__item.active::after {
  background: var(--accent-primary);
}

/* Cards - Railway inspired */
.card {
  background: #181622;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.card--elevated {
  background: #181622;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-sm);
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

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

/* Buttons - Railway style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #211F2D;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn:hover {
  background: #272532;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.success {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.btn.success:hover {
  background: #059669;
  border-color: #059669;
}

.btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.1);
}

.btn.ghost:hover {
  background: #211F2D;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn.large {
  padding: 14px 24px;
  font-size: 15px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Custom form buttons */
.btn-client-selector,
.btn-add-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #211F2D;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-client-selector:hover,
.btn-add-item:hover {
  background: #272532;
  border-color: rgba(255, 255, 255, 0.15);
}

/* Line item buttons */
.btn-drag-handle,
.btn-remove,
.btn-item-list,
.btn-upload-photo,
.btn-save-as-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #211F2D;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn-drag-handle:hover,
.btn-remove:hover,
.btn-item-list:hover,
.btn-upload-photo:hover,
.btn-save-as-item:hover {
  background: #272532;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-drag-handle {
  cursor: grab;
  padding: 8px;
}

.btn-drag-handle:active {
  cursor: grabbing;
}

.btn-remove {
  padding: 6px 12px;
  font-size: 18px;
  line-height: 1;
}

/* Input fields */
input,
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: #13111C;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: #13111C;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

/* Prevent autofill white background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:active,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus,
select:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px #13111C inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  box-shadow: 0 0 0 30px #13111C inset !important;
  color: var(--text-primary) !important;
  transition: background-color 5000s ease-in-out 0s;
}

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

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

.search-input {
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b6b6b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.search-input:focus {
  background-color: #13111C;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%237c3aed' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--border-normal);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  transition: var(--transition);
}

.pill.success {
  background: var(--success-soft);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.pill.warning {
  background: var(--warning-soft);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.pill.error {
  background: var(--error-soft);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--error);
}

/* Status indicator dot */
.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Grid layouts */
.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.grid.four {
  grid-template-columns: repeat(4, 1fr);
}

/* Document list */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-card {
  background: #211F2D;
  border: 1px solid #33323E;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  transition: var(--transition);
  cursor: pointer;
  min-height: 70px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.doc-card:hover {
  border-color: #3d3b4a;
  background: #272532;
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.doc-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
  flex-shrink: 0;
}

.doc-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-card__meta {
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-card__total {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.doc-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.doc-card__actions .btn {
  min-width: 70px;
}

/* Dropdown for Share button */
.dropdown-container {
  position: relative;
  display: block;
}

.dropdown-container .btn {
  width: 100%;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #211F2D;
  border: 1px solid #33323E;
  border-radius: var(--radius-sm);
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  overflow: hidden;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.dropdown-item:hover {
  background: #272532;
}

/* Summary cards */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
  max-width: 1200px;
}

.summary__card {
  padding: 20px;
  background: #211F2D;
  border: 1px solid #33323E;
  border-radius: var(--radius-md);
  transition: var(--transition);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.summary__card:hover {
  border-color: #3d3b4a;
  background: #272532;
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.summary__value {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 8px;
  color: var(--text-primary);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.hidden {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal__content {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  background: #1a1825;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.wide .modal__content {
  max-width: 900px;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal__body {
  padding: 24px;
}

/* Modal forms */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.form-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
}

/* Autocomplete dropdown */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #1a1825;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

.autocomplete-dropdown.hidden {
  display: none;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  color: var(--text-primary);
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-primary);
}

.autocomplete-item:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.form__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.form__actions .muted {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Clients grid - Railway style */
.clients-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.client-card {
  background: #211F2D;
  border: 1px solid #33323E;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  transition: var(--transition);
  cursor: pointer;
  min-height: 70px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.client-card:hover {
  border-color: #3d3b4a;
  background: #272532;
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.client-card__header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
  flex-shrink: 0;
}

.client-card__info {
  flex: 1;
  min-width: 0;
}

.client-card__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-card__company {
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-card__contact {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.client-card__contact-item {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-card__notes {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.client-card__actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.client-card__actions .btn {
  min-width: 70px;
}

/* Items and Materials grids - matching client style */
.items-grid,
.materials-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.item-card,
.material-card {
  background: #211F2D;
  border: 1px solid #33323E;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  transition: var(--transition);
  cursor: pointer;
  min-height: 70px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.item-card:hover,
.material-card:hover {
  border-color: #3d3b4a;
  background: #272532;
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.item-card__header,
.material-card__header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
  flex-shrink: 0;
}

.item-card__name,
.material-card__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card__description,
.material-card__description {
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card__details,
.material-card__details {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.item-card__detail,
.material-card__detail {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.item-card__actions,
.material-card__actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.item-card__actions .btn,
.material-card__actions .btn {
  min-width: 70px;
}

/* Workspace */
.workspace {
  margin-bottom: 32px;
}

.workspace__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* Filter pills / Status filters */
.pill-nav,
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 0;
}

.pill-nav button,
.filters button {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #181622;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.pill-nav button:hover,
.filters button:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: #1f1d2b;
  color: var(--text-primary);
}

.pill-nav button.active,
.filters button.active {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.4);
  color: var(--accent-primary);
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.25), 0 0 16px rgba(124, 58, 237, 0.12);
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Loading state */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .page {
    padding: 0 16px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  .card {
    padding: 20px;
  }

  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }

  /* Document cards - compact mobile layout */
  .doc-card {
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    min-height: auto;
    align-items: stretch;
  }

  .doc-card__info {
    min-width: 0;
    width: 100%;
  }

  .doc-card__meta {
    font-size: 11px;
    line-height: 1.4;
  }

  .doc-card__total {
    font-size: 20px;
    text-align: left;
    margin-top: 4px;
  }

  .doc-card__actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    margin-left: 0;
    gap: 6px;
    margin-top: 4px;
  }

  .doc-card__actions .btn {
    min-width: 0;
    width: auto;
    padding: 8px 12px;
    font-size: 13px;
  }

  .doc-card__actions .pill {
    grid-column: 1 / -1;
    justify-content: center;
    width: 100%;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .workspace__header {
    flex-direction: column;
    align-items: stretch;
  }

  .btn:not(.doc-card__actions .btn):not(.client-card__actions .btn):not(.item-card__actions .btn):not(.material-card__actions .btn) {
    width: 100%;
  }

  /* Client cards - stack vertically on mobile */
  .client-card {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    min-height: auto;
  }

  .client-card__header {
    min-width: 0;
    width: 100%;
  }

  .client-card__contact {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .client-card__contact-item {
    width: 100%;
  }

  .client-card__notes {
    max-width: 100%;
    width: 100%;
  }

  .client-card__actions {
    width: 100%;
    margin-left: 0;
    gap: 8px;
  }

  .client-card__actions .btn {
    flex: 1;
    min-width: 0;
  }

  /* Item and Material cards - compact mobile layout */
  .item-card,
  .material-card {
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    min-height: auto;
  }

  .item-card__header,
  .material-card__header {
    min-width: 0;
    width: 100%;
    gap: 4px;
  }

  .item-card__description,
  .material-card__description {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
  }

  .item-card__details,
  .material-card__details {
    flex-direction: row;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
  }

  .item-card__detail,
  .material-card__detail {
    width: auto;
    flex: 0 0 auto;
    font-size: 11px;
  }

  .item-card__actions,
  .material-card__actions {
    width: 100%;
    margin-left: 0;
    gap: 6px;
  }

  .item-card__actions .btn,
  .material-card__actions .btn {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}
