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

  :root {
    --radius: 10px;
    --radius-sm: 6px;
    --grayBackgroundColor: gray;
    --whiteBackgroundColor:white;
    --cardbackgroundColor: white;
    --blackText:black;
    --grayText:gray;
    --blueText:blue;
}

body.dark{
    --grayBackgroundColor: gray;
    --whiteBackgroundColor:black;
    --cardbackgroundColor: black;
    --blackText:white;
    --grayText:white;
    --blueText:lightblue;
}

  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--grayBackgroundColor);
    color: var(--blackText);
    min-height: 100vh;
    padding: 0;
}

  header {
    background: var(--whiteBackgroundColor);
    border-bottom: 1px solid var(--grayBackgroundColor);
    padding: 18px 24px;
}

  header h1 {
    font-size: 20px; 
    font-weight: 600; 
    letter-spacing: -0.3px;
}

  header p {
    font-size: 13px; 
    color: var(--grayText); 
    margin-top: 2px; 
}

  main {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
}

  .upload-card {
    background: var(--whiteBackgroundColor);
    border: 1.5px dashed var(--grayBackgroundColor);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    margin-bottom: 24px;
    cursor: pointer;
    transition: border-color 0.2s;
}
  .upload-card:hover { border-color: var(--blueText); }
  .upload-card.drag-over { border-color: var(--blueText); background: lightblue; }
  .upload-icon { font-size: 32px; margin-bottom: 12px; }
  .upload-card h2 { font-size: 16px; font-weight: 500; margin-bottom: 6px; }
  .upload-card p { font-size: 13px; color: var(--grayBackgroundColor); margin-bottom: 16px; }
  .upload-card input[type=file] { display: none; }

  .btn {
    display: inline-block;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-border);
    background: var(--whiteBackgroundColor);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}
  .btn:hover { background: var(--grayBackgroundColor); }
  .btn-primary { background: var(--blueText); color: var(--whiteBackgroundColor); border-color: var(--blue); }
  .btn-primary:hover { background: blue; }
  .btn-sm { padding: 6px 14px; font-size: 12px; }

  .error-box {
    background: var(--grayBackgroundColor);
    border: 1px solid orange;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: red;
    margin-bottom: 16px;
    display: none;
}

  .phase-legend { display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
  .phase-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
}
  .phase-dot { 
    width: 8px; 
    height: 8px; 
    border-radius: 50%;
}

  .metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}
  .metric-card {
    background: var(--whiteBackgroundColor);
    border: 1px solid grey;
    border-radius: var(--radius);
    padding: 14px 16px;
}
  .metric-card .label { 
    font-size: 11px; 
    color: var(--grayText); 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    margin-bottom: 6px;
}

  .metric-card .value {
    font-size: 22px; 
    font-weight: 600; 
    line-height: 1;
}
  .metric-card .unit {
    font-size: 12px; 
    color: var(--grayText); 
    font-weight: 400; 
    margin-left: 2px;
}

  .card {
    background: var(--whiteBackgroundColor);
    border: 1px solid gray;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
  .card-title {
    font-size: 15px;
    font-weight: 600;
}
  .card-actions { 
    display: flex;
     gap: 8px;
}

  .chart-wrap {
    position: relative;
    height: 220px;
}

  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-text);
    border-bottom: 1px solid gray;
  }
  td { padding: 10px 12px; border-bottom: 1px solid gray; }
  tr:last-child td { border-bottom: none; }
  td.metric-name { font-weight: 500; }
  td.unit-cell { color: gray; font-size: 12px; }

  .results { display: none; }

  @media (max-width: 600px) {
    main { padding: 16px 12px; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .card { padding: 14px; }
    .chart-wrap { height: 180px; }
    th, td { padding: 8px 10px; }
    .card-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  }
