:root {
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;

  color-scheme: light dark;
  color: rgba(255, 255, 255, 0.87);
  background-color: #242424;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  font-weight: 500;
  color: #646cff;
  text-decoration: inherit;
}
a:hover {
  color: #535bf2;
}

body {
  margin: 0;
  display: flex;
  place-items: center;
  min-width: 320px;
  min-height: 100vh;
}

h1 {
  font-size: 3.2em;
  line-height: 1.1;
}

button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  background-color: #1a1a1a;
  cursor: pointer;
  transition: border-color 0.25s;
}
button:hover {
  border-color: #646cff;
}
button:focus,
button:focus-visible {
  outline: 4px auto -webkit-focus-ring-color;
}

@media (prefers-color-scheme: light) {
  :root {
    color: #213547;
    background-color: #ffffff;
  }
  a:hover {
    color: #747bff;
  }
  button {
    background-color: #f9f9f9;
  }
}
/* Dark mode support with CSS custom properties */
:root {
    --card-bg: #ffffff;
    --card-border: #e0e0e0;
    --card-hover-border: #007acc;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --card-hover-shadow: rgba(0, 0, 0, 0.15);
    --text-primary: #333333;
    --text-secondary: #666666;
    --divider-color: #f0f0f0;
    --id-bg: #f5f5f5;
    --shimmer-color: rgba(255, 255, 255, 0.2);
}

@media (prefers-color-scheme: dark) {
    :root {
        --card-bg: #2a2a2a;
        --card-border: #404040;
        --card-hover-border: #4a9eff;
        --card-shadow: rgba(0, 0, 0, 0.2);
        --card-hover-shadow: rgba(0, 0, 0, 0.3);
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --divider-color: #404040;
        --id-bg: #3a3a3a;
        --shimmer-color: rgba(255, 255, 255, 0.1);
    }
}

/* Override body styles for full width */
body {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    place-items: unset !important;
    min-width: unset !important;
    min-height: unset !important;
}

#root {
    margin: 0;
    padding: 0;
}

/* Full screen app container */
.app-container {
    min-height: 100vh;
    padding: 10px;
    font-size: 14px;
    box-sizing: border-box;
    margin: 0;
}

/* Header spanning full width */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--divider-color);
}

.header h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.refresh-button {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    transition: all 0.2s ease;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
}

.refresh-button:hover:not(:disabled) {
    border-color: var(--card-hover-border);
    background: var(--id-bg);
}

.refresh-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Section header */
.orders-section {
    margin: 0;
}

.orders-section h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

/* Full width grid */
.orders-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Full width card styling */
.order-card {
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 12px;
    background: var(--card-bg);
    box-shadow: 0 1px 3px var(--card-shadow);
    box-sizing: border-box;
}

.order-card.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.order-card.clickable::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--shimmer-color), transparent);
    transition: left 0.3s;
}

.order-card.clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px var(--card-hover-shadow);
    border-color: var(--card-hover-border);
}

.order-card.clickable:hover::before {
    left: 100%;
}

.order-card.clickable:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px var(--card-shadow);
}

.order-card.clickable:focus {
    outline: 1px solid var(--card-hover-border);
    outline-offset: 1px;
}

/* Card header */
.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--divider-color);
    gap: 12px;
}

.order-subject {
    margin: 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    word-wrap: break-word;
}

.order-id {
    background: var(--id-bg);
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.order-id-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.order-link {
    text-decoration: none;
    font-size: 16px;
    line-height: 1;
    transition: transform 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.order-link:hover {
    transform: scale(1.2);
}

.order-link:active {
    transform: scale(1.1);
}

/* Order details */
.order-detail {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    padding: 2px 0;
    gap: 12px;
}

.order-detail:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 70px;
    flex-shrink: 0;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 400;
    font-size: 12px;
    text-align: right;
    word-break: break-word;
    flex: 1;
}

/* Loading state */
.loading {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 16px;
    font-size: 13px;
}

/* Error message */
.error-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    margin: 12px 0;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    .error-message {
        background: #4a3a1a;
        border-color: #805b00;
    }
}

.error-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.error-text {
    color: #856404;
    font-size: 13px;
    line-height: 1.5;
    flex: 1;
}

@media (prefers-color-scheme: dark) {
    .error-text {
        color: #ffd966;
    }
}

/* Ensure no horizontal overflow */
* {
    box-sizing: border-box;
}

/* Responsive adjustments for very narrow taskpanes */
@media (max-width: 250px) {
    .app-container {
        padding: 8px;
    }

    .order-card {
        padding: 10px;
    }

    .header h1 {
        font-size: 16px;
    }

    .order-subject {
        font-size: 13px;
    }

    .detail-label,
    .detail-value {
        font-size: 11px;
    }

    .detail-label {
        min-width: 60px;
    }
}